For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

How to get a bound box of a shape?

Albert's picture
Forums: 

Is it realizable for both AIS_Shape and TopoDS_Shape?

xiuerlee's picture

double Xmin, Ymin, Zmin, Xmax, Ymax, Zmax;

//Compute the parameters
TopoDS_Shape theShape = ##;
Bnd_Box B;

BRepBndLib::Add(theShape, B);
B.Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);

PG's picture

I feel this is the 'global' bounding box - relative to
the Gloabl XYZ system.

Anybody has a solution to 'local/oriented' bounding box
i.e. minimum size of box (maybe the volume) to 'pack' it
in a box.
thanks
-PG

Albert's picture

Thank all of you!
How to gain the 'local/oriented' bounding box? And, how to represent the minimum size of box(volume)?

Albert's picture

Why is the result incorrect with the method above? The bound box is doesn't surround the TopoDS_Shape object. And there is a large difference in eigther location or size.

Lodyzhensky's picture

Dear Albert.

1. Why is the result incorrect with the method above?
-Please do not be a hurry with conclusions.
The answer is inside the code of the class BRepBndLib.
In order to get the result more preciely, try to triangulate your shape before the call
BRepBndLib::Add(theShape, B);

2. The bound box is doesn't surround the TopoDS_Shape object. And there is a large difference in eigther location or size.
- It is impossible to help you without a possibility to see data.
Upload your shape somewhere in order to have a look on it please.

Jun WANG's picture

Albert, u r right. The BRepBndLib::Get() can only get the bounding box, instead of MINIMAL bounding box. The minimal bounding box should be independent on the absolute XYZ coordinates of points on the 3D model so that the mininal bounding box would be still constant even if the 3D model has been transferred with another orientation. If you want to get the Minimal bounding box, you can refer to the paper: "Efficiently Approximating the Minimum-Volume Bounding Box of a Point Set in Three Dimensions".

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.