36 #include <Inventor/SbVec2f.h> 45 SbBox2f(
float xmin,
float ymin,
float xmax,
float ymax)
46 : minpt(xmin, ymin), maxpt(xmax, ymax) { }
48 : minpt(minpoint), maxpt(maxpoint) { }
51 explicit SbBox2f(
const SbBox2i32 & box) { setBounds(box); }
54 { minpt.setValue(xmin, ymin); maxpt.setValue(xmax, ymax);
return *
this; }
56 { minpt = minpoint; maxpt = maxpoint;
return *
this; }
59 SbBox2f & setBounds(
const SbBox2i32 & box);
61 void getBounds(
float & xmin,
float & ymin,
float & xmax,
float & ymax)
const 62 { minpt.getValue(xmin, ymin); maxpt.getValue(xmax, ymax); }
64 { minpoint = minpt; maxpoint = maxpt; }
70 SbVec2f & getMax(
void) {
return maxpt; }
72 void extendBy(
const SbVec2f & point);
73 void extendBy(
const SbBox2f & 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 SbVec2f & point)
const;
79 SbBool intersect(
const SbBox2f & box)
const;
83 void getOrigin(
float & originX,
float & originY)
const 84 { minpt.getValue(originX, originY); }
85 void getSize(
float & sizeX,
float & sizeY)
const 86 {
if (isEmpty()) { sizeX = sizeY = 0.0f; }
87 else { sizeX = maxpt[0] - minpt[0]; sizeY = maxpt[1] - minpt[1]; } }
90 this->getSize(v[0], v[1]);
95 { SbDividerChk(
"SbBox2f::getAspectRatio()", maxpt[1] - minpt[1]);
96 return (maxpt[0] - minpt[0]) / (maxpt[1] - minpt[1]); }
111 #endif // !COIN_SBBOX2F_H The SbVec2f class is a 2 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec2f.h:49
SbBox2f(float xmin, float ymin, float xmax, float ymax)
Definition: SbBox2f.h:45
SbBox2f(void)
Definition: SbBox2f.h:44
SbBool isEmpty(void) const
Definition: SbBox2f.h:75
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
void getBounds(SbVec2f &minpoint, SbVec2f &maxpoint) const
Definition: SbBox2f.h:63
SbBool hasArea(void) const
Definition: SbBox2f.h:76
SbBox2f & setBounds(float xmin, float ymin, float xmax, float ymax)
Definition: SbBox2f.h:53
float getAspectRatio(void) const
Definition: SbBox2f.h:94
void getSize(float &sizeX, float &sizeY) const
Definition: SbBox2f.h:85
The SbBox2s class is a 2 dimensional box with short integer coordinates.This box class is used by oth...
Definition: SbBox2s.h:43
const SbVec2f & getMax(void) const
Definition: SbBox2f.h:69
The SbBox2f class is a 2 dimensional box with floating point corner coordinates.This box class is use...
Definition: SbBox2f.h:42
const SbVec2f & getMin(void) const
Definition: SbBox2f.h:66
void getOrigin(float &originX, float &originY) const
Definition: SbBox2f.h:83
SbBox2f(const SbVec2f &minpoint, const SbVec2f &maxpoint)
Definition: SbBox2f.h:47
SbVec2f getCenter(void) const
Definition: SbBox2f.h:82
SbBox2f & setBounds(const SbVec2f &minpoint, const SbVec2f &maxpoint)
Definition: SbBox2f.h:55
void getBounds(float &xmin, float &ymin, float &xmax, float &ymax) const
Definition: SbBox2f.h:61
SbVec2f & getMin(void)
Definition: SbBox2f.h:67