Hello Peter,

In both cases, my intuition is that even the worst-case AABB is still going to represent a much tighter bound than the best-case bounding sphere, leading to unnecessary and expensive tests against the actual geometry.

Actually, the osg::Node hierarchy uses bounding spheres, but the osg::Drawable hierarchy uses AABBs. Once an intersection returns a success against the BS, it will go down to the osg::Geodes, then loop through the geode's drawables, checking their AABBs for intersection as well. Only once one or more of these returns a success will it test geometry.

See src/osgUtil/LineSegmentIntersector.cpp, method intersect(IntersectionVisitor&, Drawable*):

void LineSegmentIntersector::intersect(osgUtil::IntersectionVisitor& iv,
                                       osg::Drawable* drawable)
{
    osg::Vec3d s(_start), e(_end);
    if ( !intersectAndClip( s, e, drawable->getBound() ) ) return;
    // ...

Here, intersectAndClip() checks the drawable's bounding box for intersections and returns false if there were none.

So your intuition is right, but OSG already does this. You're welcome to go down into the intersection visitor / line segment intersector and improve upon this, of course.

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to