Bnd_Box module



We are using Bnd_Box api to calculate a bounding box of a component (STEP & IGES format) parallel to all principle planes. However this does not give the exact dimensions for the bouding box and has some tolerance added to these values. For example a cylinder with a diameter 100 and height 50 gives a bounding box as101.5 x 101.5 x 50.

Alternatively, we have also tried to trace the vertices to find maximum and minimum values in all respective principle axis. However it failed as for cylindrical parts as it gives dimension in axis and only one direction normal to axis. For the same cylinder we get values as 100 x 0 x 50.

Can we have some solution to resolve this case for cylindrical parts? OR can we have details about Bnd_Box api so that we can alter some settings to get accurate results.

Thanks in advance.

Forum supervisor's picture

Dear Jitendra,

There is no "Bnd_Box" API in OCCT - Bnd_Box is just a structure holding definition of axis-aligned bounding box.
There are, however, tools for filling in this box with shapes (BRepBndLib) and geometry (BndLib).

The main purpose of bounding box in most algorithm are optimizations (for fast checks) and visualization,
where it is required to have a box which is guaranteed to include the whole object, but it is OK to have some more space in it.
Computation of "perfect" bounding box for geometry is computationally more expensivethen computing rough bounding box - for this reason rough box is much more useful in most cases.

For computing optimal bounding box - refer to the method BRepBndLib::AddOptimal().

Best regards, FSR