1 #ifndef COIN_SBBOX2I32_H
2 #define COIN_SBBOX2I32_H
27 #include <Inventor/SbVec2i32.h>
28 #include <Inventor/SbVec2f.h>
37 SbBox2i32(int32_t xmin, int32_t ymin, int32_t xmax, int32_t ymax)
38 : minpt(xmin, ymin), maxpt(xmax, ymax) { }
40 : minpt(minpoint), maxpt(maxpoint) { }
45 SbBox2i32 & setBounds(int32_t xmin, int32_t ymin, int32_t xmax, int32_t ymax)
46 { minpt.setValue(xmin, ymin); maxpt.setValue(xmax, ymax);
return *
this; }
48 { minpt = minpoint; maxpt = maxpoint;
return *
this; }
53 void getBounds(int32_t & xmin, int32_t & ymin, int32_t & xmax, int32_t & ymax)
const
54 { minpt.getValue(xmin, ymin); maxpt.getValue(xmax, ymax); }
56 { minpoint = minpt; maxpoint = maxpt; }
66 SbBool
isEmpty(
void)
const {
return (maxpt[0] < minpt[0]); }
67 SbBool
hasArea(
void)
const {
return ((maxpt[0] > minpt[0]) && (maxpt[1] > minpt[1])); }
69 SbBool intersect(
const SbVec2i32 & point)
const;
70 SbBool intersect(
const SbBox2i32 & box)
const;
73 void getOrigin(int32_t & originX, int32_t & originY)
const
74 { minpt.getValue(originX, originY); }
75 void getSize(int32_t & sizeX, int32_t & sizeY)
const
76 {
if (isEmpty()) { sizeX = sizeY = 0; }
77 else { sizeX = maxpt[0] - minpt[0]; sizeY = maxpt[1] - minpt[1]; } }
78 float getAspectRatio(
void)
const
79 { SbDividerChk(
"SbBox2i32::getAspectRatio()", maxpt[1] - minpt[1]);
80 return float(maxpt[0] - minpt[0]) / float(maxpt[1] - minpt[1]); }
95 #endif // !COIN_SBBOX2I32_H