16 double maxX,
double maxY,
double maxZ) {
30 smallerX = box.smallerX;
31 smallerY = box.smallerY;
32 smallerZ = box.smallerZ;
33 greaterX = box.greaterX;
34 greaterY = box.greaterY;
35 greaterZ = box.greaterZ;
42 smallerX = box.smallerX;
43 smallerY = box.smallerY;
44 smallerZ = box.smallerZ;
45 greaterX = box.greaterX;
46 greaterY = box.greaterY;
47 greaterZ = box.greaterZ;
54 smallerX = box.smallerX;
55 smallerY = box.smallerY;
56 smallerZ = box.smallerZ;
57 greaterX = box.greaterX;
58 greaterY = box.greaterY;
59 greaterZ = box.greaterZ;
65 center.SetXYZW((greaterX + smallerX)/2,
66 (greaterY + smallerY)/2,
67 (greaterZ + smallerZ)/2, 1);
134 double maxX,
double maxY,
double maxZ) {
152 if (x > greaterX) greaterX = x;
157 if (y > greaterY) greaterY = y;
162 if (z > greaterZ) greaterZ = z;
167 ConditionalUpdate(point.
GetX(), point.
GetY(), point.
GetZ());
171 ConditionalUpdate(box.smallerX, box.smallerY, box.smallerZ);
172 ConditionalUpdate(box.greaterX, box.greaterY, box.greaterZ);
176 double greater = greaterX - smallerX;
177 double tmp = greaterY - smallerY;
181 tmp = greaterZ - smallerZ;
188 double smaller = greaterX - smallerX;
189 double tmp = greaterY - smallerY;
193 tmp = greaterZ - smallerZ;
206 static float fVec[4];
208 glDisable(GL_LIGHTING);
211 glBegin (GL_LINE_LOOP);
212 glVertex3d (smallerX, greaterY, smallerZ);
213 glVertex3d (greaterX, greaterY, smallerZ);
214 glVertex3d (greaterX, smallerY, smallerZ);
215 glVertex3d (smallerX, smallerY, smallerZ);
217 glBegin(GL_LINE_LOOP);
218 glVertex3d (smallerX, smallerY, smallerZ);
219 glVertex3d (smallerX, smallerY, greaterZ);
220 glVertex3d (smallerX, greaterY, greaterZ);
221 glVertex3d (smallerX, greaterY, smallerZ);
223 glBegin(GL_LINE_LOOP);
224 glVertex3d (greaterX, greaterY, greaterZ);
225 glVertex3d (smallerX, greaterY, greaterZ);
226 glVertex3d (smallerX, smallerY, greaterZ);
227 glVertex3d (greaterX, smallerY, greaterZ);
229 glBegin(GL_LINE_LOOP);
230 glVertex3d (greaterX, smallerY, smallerZ);
231 glVertex3d (greaterX, greaterY, smallerZ);
232 glVertex3d (greaterX, greaterY, greaterZ);
233 glVertex3d (greaterX, smallerY, greaterZ);
235 glEnable(GL_LIGHTING);
244 if (b.greaterX < smallerX)
246 if (b.smallerX > greaterX)
248 if (b.greaterZ < smallerZ)
250 if (b.smallerZ > greaterZ)
252 if (b.greaterY < smallerY)
254 if (b.smallerY > greaterY)
261 if (p.
GetX() < smallerX)
263 if (p.
GetX() > greaterX)
265 if (p.
GetZ() < smallerZ)
267 if (p.
GetZ() > greaterZ)
269 if (p.
GetY() < smallerY)
271 if (p.
GetY() > greaterY)
279 if (box.greaterX < greaterX)
280 greaterX = box.greaterX;
281 if (box.smallerX > smallerX)
282 smallerX = box.smallerX;
283 if (box.greaterZ < greaterZ)
284 greaterZ = box.greaterZ;
285 if (box.smallerZ > smallerZ)
286 smallerZ = box.smallerZ;
287 if (box.greaterY < greaterY)
288 greaterY = box.greaterY;
289 if (box.smallerY > smallerY)
290 smallerY = box.smallerY;
295 output <<
"(Greaters: " << box.greaterX <<
"," << box.greaterY <<
","
296 << box.greaterZ <<
" Smallers: " << box.smallerX <<
","
297 << box.smallerY <<
"," << box.smallerZ <<
")";
bool DrawInstanceOGL() const
Draws a bounding box.
BoundingBox()
Creates an uninitialized bounding box.
static const Color & RED()
Red opaque color.
Points and vectors using homogeneous coordinates.
bool visible
Indicates wether the bounding box is visible.
void CutBBox(const BoundingBox &box)
Test against other bounding box and update itself if its outside the given bbox.
void SetBoundingBox(double minX, double minY, double minZ, double maxX, double maxY, double maxZ)
void ConditionalUpdate(double x, double y, double z)
Updates the bounding box if any given coordinate is outside it.
void CopyGeometryFrom(const BoundingBox &box)
Copies geometry data from other bounding box.
std::ostream & operator<<(std::ostream &output, const Joint::DofID &dofId)
void MergeWith(const BoundingBox &box)
Merges a bounding with another, expanding it.
Axis aligned bounding box.
BoundingBox & operator=(const BoundingBox &box)
double GetGreaterZ() const
double GetSmallerX() const
bool testPoint(VART::Point4D p)
Test if a point is included in the bbox.
double GetSmallerY() const
Header file for V-ART class "BoundingBox".
void SetGreaterY(double v)
double GetGreaterY() const
void ToggleVisibility()
Toggles the visibility.
double GetSmallerEdge() const
Returns the length of the smaller edge.
void SetSmallerZ(double v)
void SetGreaterX(double v)
const Point4D & GetCenter() const
void ApplyTransform(const Transform &trans)
Applies transformation to a BoundingBox.
double GetGreaterEdge() const
Returns the length of the greater edge.
bool testAABBAABB(BoundingBox &b)
Test intersection among AABBs.
void SetSmallerX(double v)
void SetSmallerY(double v)
double GetGreaterX() const
void SetGreaterZ(double v)
double GetSmallerZ() const