# How to get a bound box of a shape?

Is it realizable for both AIS_Shape and TopoDS_Shape?

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

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

B.Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);

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

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

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.

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

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.

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".