Getting the bounding box
The bounding box of an entity is a box-shaped volume which geometrically contains the entity and all its sub-entities.
With PRC you can get the axis-aligned bounding box of any visible entity using either A3DMiscGetBoundingBox or A3DMiscComputeBoundingBox. The two functions differ in how they do it.
Axis-aligned bounding box
An axis-aligned bounding box (AABB) is aligned the with axes of the coordinate system. Because of that property it is very simple to define the coordinates of a AABB. Only two points forming a diagonal of the box are required. These points are known as the min and max coordinates for they respectively represent the minimum and maximum values of the box in each axis.
With HOOPS Exchange such bounding boxes are described with an A3DBoundingBoxData instance:
Where A3DVector3dData is defined as:
Reading the bounding box from a PRC tree
To read the bounding box from a PRC tree use A3DMiscGetBoundingBox. This function can be used on an A3DAsmModelFile, an A3DAsmProductOccurrence, an A3DAsmPartDefinition or an A3DRiSet. If no bounding box is found the function will return an empty one:
For more information, see A3DMiscGetBoundingBox.
Computing the bounding box from tessellation
If you prefer, you may use A3DMiscComputeBoundingBox to make HOOPS Exchange compute the bounding box instead of reading it. A bounding box will be determined using the tessellation info of the visibles entities.
The function returns an invalid bounding box in case of failure:
For more information, see A3DMiscComputeBoundingBox.