1 #ifndef COIN_SBBOX2I32_H 2 #define COIN_SBBOX2I32_H 36 #include <Inventor/SbVec2i32.h> 37 #include <Inventor/SbVec2f.h> 43 class COIN_DLL_API SbBox2i32 {
45 SbBox2i32(
void) { makeEmpty(); }
46 SbBox2i32(int32_t xmin, int32_t ymin, int32_t xmax, int32_t ymax)
47 : minpt(xmin, ymin), maxpt(xmax, ymax) { }
49 : minpt(minpoint), maxpt(maxpoint) { }
50 explicit SbBox2i32(
const SbBox2s & box) { setBounds(box); }
51 explicit SbBox2i32(
const SbBox2f & box) { setBounds(box); }
52 explicit SbBox2i32(
const SbBox2d & box) { setBounds(box); }
54 SbBox2i32 & setBounds(int32_t xmin, int32_t ymin, int32_t xmax, int32_t ymax)
55 { minpt.setValue(xmin, ymin); maxpt.setValue(xmax, ymax);
return *
this; }
57 { minpt = minpoint; maxpt = maxpoint;
return *
this; }
58 SbBox2i32 & setBounds(
const SbBox2s & box);
59 SbBox2i32 & setBounds(
const SbBox2f & box);
60 SbBox2i32 & setBounds(
const SbBox2d & box);
62 void getBounds(int32_t & xmin, int32_t & ymin, int32_t & xmax, int32_t & ymax)
const 63 { minpt.getValue(xmin, ymin); maxpt.getValue(xmax, ymax); }
65 { minpoint = minpt; maxpoint = maxpt; }
67 const SbVec2i32 & getMin(
void)
const {
return minpt; }
68 SbVec2i32 & getMin(
void) {
return minpt; }
69 const SbVec2i32 & getMax(
void)
const {
return maxpt; }
70 SbVec2i32 & getMax(
void) {
return maxpt; }
73 void extendBy(
const SbBox2i32 & box);
75 SbBool isEmpty(
void)
const {
return (maxpt[0] < minpt[0]); }
76 SbBool hasArea(
void)
const {
return ((maxpt[0] > minpt[0]) && (maxpt[1] > minpt[1])); }
78 SbBool intersect(
const SbVec2i32 & point)
const;
79 SbBool intersect(
const SbBox2i32 & box)
const;
81 SbVec2f getCenter(
void)
const {
return SbVec2f((minpt[0] + maxpt[0]) * 0.5f, (minpt[0] + maxpt[0]) * 0.5f); }
82 void getOrigin(int32_t & originX, int32_t & originY)
const 83 { minpt.getValue(originX, originY); }
84 void getSize(int32_t & sizeX, int32_t & sizeY)
const 85 {
if (isEmpty()) { sizeX = sizeY = 0; }
86 else { sizeX = maxpt[0] - minpt[0]; sizeY = maxpt[1] - minpt[1]; } }
89 this->getSize(v[0], v[1]);
92 float getAspectRatio(
void)
const 93 { SbDividerChk(
"SbBox2i32::getAspectRatio()", maxpt[1] - minpt[1]);
94 return float(maxpt[0] - minpt[0]) / float(maxpt[1] - minpt[1]); }
101 COIN_DLL_API
inline int operator == (
const SbBox2i32 & b1,
const SbBox2i32 & b2) {
102 return ((b1.getMin() == b2.getMin()) && (b1.getMax() == b2.getMax()));
105 COIN_DLL_API
inline int operator != (
const SbBox2i32 & b1,
const SbBox2i32 & b2) {
109 #endif // !COIN_SBBOX2I32_H The SbVec2f class is a 2 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec2f.h:49
The SbBox2d class is a 2 dimensional box with double precision corner coordinates.This box class is used by many other classes in Coin for data exchange and storage. It provides two box corners with double precision coordinates, which is among other things useful for representing screen or canvas dimensions in normalized coordinates.
Definition: SbBox2d.h:42
The SbBox2s class is a 2 dimensional box with short integer coordinates.This box class is used by oth...
Definition: SbBox2s.h:43
The SbBox2f class is a 2 dimensional box with floating point corner coordinates.This box class is use...
Definition: SbBox2f.h:42
The SbVec2i32 class is a 2 dimensional vector with short integer coordinates.This vector class is use...
Definition: SbVec2i32.h:50