Basic type: arbitrarily oriented 3D bounding box.
This class represents a three-dimensional bounding box as an axis-aligned box (GfRange3d
) and a matrix (GfMatrix4d
) to transform it into the correct space.
A GfBBox3d
is more useful than using just GfRange3d
instances (which are always axis-aligned) for these reasons:
- When an axis-aligned bounding box is transformed several times, each transformation can result in inordinate growth of the bounding box. By storing the transformation separately, it can be applied once at the end, resulting in a much better fit. For example, if the bounding box at the leaf of a scene graph is transformed through several levels of the graph hierarchy to the coordinate space at the root, a
GfBBox3d
is generally much smaller than the GfRange3d
computed by transforming the box at each level.
- When two or more such bounding boxes are combined, having the transformations stored separately means that there is a better opportunity to choose a better coordinate space in which to combine the boxes.
The Zero-area Primitives Flag
When bounding boxes are used in intersection test culling, it is sometimes useful to extend them a little bit to allow lower-dimensional objects with zero area, such as lines and points, to be intersected. For example, consider a cube constructed of line segments. The bounding box for this shape fits the cube exactly. If an application wants to allow a near-miss of the silhouette edges of the cube to be considered an intersection, it has to loosen the bbox culling test a little bit.
To distinguish when this loosening is necessary, each GfBBox3d
instance maintains a flag indicating whether any zero-area primitives are contained within it. The application is responsible for setting this flag correctly by calling SetHasZeroAreaPrimitives()
. The flag can be accessed during intersection tests by calling HasZeroAreaPrimitives()
. This flag is set by default in all constructors to false
.
Definition at line 84 of file bbox3d.h.