bonding box


How exactly are the bounding box created for the file,
on what criteria bounding box are created,is there any way so that minimum bounding box dimension can be defined & based on minimum dimension all the bounding box will go created on any surface.

Thanks in advance.

Dennis G.'s picture

Hello Amandeep Singh,

I'm not aware of an implemented function that defines the minimum intervals, but you can try the following:
A bounding box is allways axis parallel (x, y, z). You can introduce a bounding box for a selected face, get it's interval bounds and check if the intervals match the minimum reqiurements. If not you can enlarge the bounding box.

[code] ----------------------------------------
TopoDS_Face myFace = ...;
Bnd_Box aBB;
BRepBndLib::Add(myFace, aBB);
Standard_Real x_min, x_Max, y_min, y_Max, z_min, z_Max;
aBB.Get(x_min, x_Max, y_min, y_Max, z_min, z_Max);

Standard_Real x_diff, y_diff, z_diff;

if( (x_Max-x_min) < myMinRange )
x_diff = myMinRange - (x_Max - x_min);
if( (y_Max-y_min) < myMinRange )
y_diff = myMinRange - (y_Max - y_min);
if( (z_Max-z_min) < myMinRange )
z_diff = myMinRange - (z_Max - z_min);

x_min -= x_diff/2.0;
x_Max += x_diff/2.0;
y_min -= y_diff/2.0;
y_Max += y_diff/2.0;
z_min -= z_diff/2.0;
z_Max += z_diff/2.0;

aBB.Update(x_min, x_Max, y_min, y_Max, z_min, z_Max);

[\code] ----------------------------------------

Good Luck,