Hi Gordon,

Unfortunately, OSG does not directly support what you want as osg'S bounding box, is as you have seen is a axially aligned min/max LL/UR

That is not true. OSG's bounding box supports separate xmin/xmax, ymin/ymax, zmin/zmax values, so it can represent boxes that have different sizes on all axes.

However, as Robert explained, OSG uses BoundingBox on Drawables, but BoundingSpheres on nodes. So if you just take the root node's bounding sphere and put that into a bounding box, of course you will get a bounding *cube*.

ComputeBoundsVisitor is what you need. It will compute a minimal axis-aligned bounding box for all *drawables*, not using the bounding spheres.

#include <osg/ComputeBoundsVisitor>

osg::ComputeBoundsVisitor cbbv;
node->accept(cbbv);
osg::BoundingBox bb = cbbv->getBoundingBox();

It doesn't get much simpler than that.

J-S
--
______________________________________________________
Jean-Sebastien Guay    [EMAIL PROTECTED]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to