27 #include <Inventor/SbVec3s.h>
28 #include <Inventor/SbVec3f.h>
37 SbBox3s(
short xmin,
short ymin,
short zmin,
short xmax,
short ymax,
short zmax)
38 : minpt(xmin, ymin, zmin), maxpt(xmax, ymax, zmax) { }
40 : minpt(minpoint), maxpt(maxpoint) { }
41 explicit SbBox3s(
const SbBox3i32 & box) { setBounds(box); }
45 SbBox3s & setBounds(
short xmin,
short ymin,
short zmin,
short xmax,
short ymax,
short zmax)
46 { minpt.setValue(xmin, ymin, zmin); maxpt.setValue(xmax, ymax, zmax);
return *
this; }
48 { minpt = minpoint; maxpt = maxpoint;
return *
this; }
49 SbBox3s & setBounds(
const SbBox3i32 & box);
53 void getBounds(
short & xmin,
short & ymin,
short & zmin,
54 short & xmax,
short & ymax,
short & zmax)
const
55 { minpt.getValue(xmin, ymin, zmin); maxpt.getValue(xmax, ymax, zmax); }
57 { minpoint = minpt; maxpoint = maxpt; }
60 SbVec3s & getMin(
void) {
return minpt; }
62 SbVec3s & getMax(
void) {
return maxpt; }
64 void extendBy(
const SbVec3s & pt);
65 void extendBy(
const SbBox3s & box);
67 SbBool isEmpty(
void)
const {
return (maxpt[0] < minpt[0]); }
68 SbBool hasVolume(
void)
const
69 {
return ((maxpt[0] > minpt[0]) && (maxpt[1] > minpt[1]) && (maxpt[2] > minpt[2])); }
70 int getVolume(
void)
const
71 {
short dx = 0, dy = 0, dz = 0; getSize(dx, dy, dz);
return (dx * dy * dz); }
73 SbBool intersect(
const SbVec3s & pt)
const;
74 SbBool intersect(
const SbBox3s & box)
const;
78 {
return SbVec3f((minpt[0]+maxpt[0])*0.5f, (minpt[1]+maxpt[1])*0.5f, (minpt[2]+maxpt[2])*0.5f); }
79 void getOrigin(
short & originX,
short & originY,
short & originZ)
const
80 { minpt.getValue(originX, originY, originZ); }
81 void getSize(
short & sizeX,
short & sizeY,
short & sizeZ)
const
82 {
if (isEmpty()) { sizeX = sizeY = sizeZ = 0; }
83 else { sizeX = maxpt[0] - minpt[0]; sizeY = maxpt[1] - minpt[1]; sizeZ = maxpt[2] - minpt[2]; } }
98 #endif // !COIN_SBBOX3S_H