36 #include <Inventor/SbVec3s.h> 37 #include <Inventor/SbVec3f.h> 46 SbBox3s(
short xmin,
short ymin,
short zmin,
short xmax,
short ymax,
short zmax)
47 : minpt(xmin, ymin, zmin), maxpt(xmax, ymax, zmax) { }
49 : minpt(minpoint), maxpt(maxpoint) { }
50 explicit SbBox3s(
const SbBox3i32 & box) { setBounds(box); }
54 SbBox3s &
setBounds(
short xmin,
short ymin,
short zmin,
short xmax,
short ymax,
short zmax)
55 { minpt.setValue(xmin, ymin, zmin); maxpt.setValue(xmax, ymax, zmax);
return *
this; }
57 { minpt = minpoint; maxpt = maxpoint;
return *
this; }
58 SbBox3s & setBounds(
const SbBox3i32 & box);
62 void getBounds(
short & xmin,
short & ymin,
short & zmin,
63 short & xmax,
short & ymax,
short & zmax)
const 64 { minpt.getValue(xmin, ymin, zmin); maxpt.getValue(xmax, ymax, zmax); }
66 { minpoint = minpt; maxpoint = maxpt; }
69 SbVec3s & getMin(
void) {
return minpt; }
71 SbVec3s & getMax(
void) {
return maxpt; }
73 void extendBy(
const SbVec3s & pt);
74 void extendBy(
const SbBox3s & box);
76 SbBool isEmpty(
void)
const {
return (maxpt[0] < minpt[0]); }
77 SbBool hasVolume(
void)
const 78 {
return ((maxpt[0] > minpt[0]) && (maxpt[1] > minpt[1]) && (maxpt[2] > minpt[2])); }
79 int getVolume(
void)
const 80 {
short dx = 0, dy = 0, dz = 0; getSize(dx, dy, dz);
return (dx * dy * dz); }
82 SbBool intersect(
const SbVec3s & pt)
const;
83 SbBool intersect(
const SbBox3s & box)
const;
87 {
return SbVec3f((minpt[0]+maxpt[0])*0.5f, (minpt[1]+maxpt[1])*0.5f, (minpt[2]+maxpt[2])*0.5f); }
88 void getOrigin(
short & originX,
short & originY,
short & originZ)
const 89 { minpt.getValue(originX, originY, originZ); }
90 void getSize(
short & sizeX,
short & sizeY,
short & sizeZ)
const 91 {
if (isEmpty()) { sizeX = sizeY = sizeZ = 0; }
92 else { sizeX = maxpt[0] - minpt[0]; sizeY = maxpt[1] - minpt[1]; sizeZ = maxpt[2] - minpt[2]; } }
95 this->getSize(v[0], v[1],v[2]);
112 #endif // !COIN_SBBOX3S_H The SbBox3s class is a 3 dimensional box with short integer coordinates.This box class is used by oth...
Definition: SbBox3s.h:43
The SbBox3f class is an abstraction for an axis aligned 3 dimensional box.This box abstraction class ...
Definition: SbBox3f.h:46
SbBox3s & setBounds(const SbVec3s &minpoint, const SbVec3s &maxpoint)
Definition: SbBox3s.h:56
void getBounds(short &xmin, short &ymin, short &zmin, short &xmax, short &ymax, short &zmax) const
Definition: SbBox3s.h:62
The SbVec3s class is a 3 dimensional vector with short integer coordinates.This vector class provides...
Definition: SbVec3s.h:51
SbBox3s(short xmin, short ymin, short zmin, short xmax, short ymax, short zmax)
Definition: SbBox3s.h:46
SbBox3s & setBounds(short xmin, short ymin, short zmin, short xmax, short ymax, short zmax)
Definition: SbBox3s.h:54
void getOrigin(short &originX, short &originY, short &originZ) const
Definition: SbBox3s.h:88
void getBounds(SbVec3s &minpoint, SbVec3s &maxpoint) const
Definition: SbBox3s.h:65
The SbVec3f class is a 3 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec3f.h:51
const SbVec3s & getMin(void) const
Definition: SbBox3s.h:68
void getSize(short &sizeX, short &sizeY, short &sizeZ) const
Definition: SbBox3s.h:90
const SbVec3s & getMax(void) const
Definition: SbBox3s.h:70
The SbBox3d class is an abstraction for an axis aligned 3 dimensional box.This box abstraction class ...
Definition: SbBox3d.h:46
SbBox3s(void)
Definition: SbBox3s.h:45
SbBox3s(const SbVec3s &minpoint, const SbVec3s &maxpoint)
Definition: SbBox3s.h:48