[osg-users] osg::LineSegment intersect with Box and Sphere inconsistency

Wojciech Lewandowski w.p.lewandowski at gmail.com
Sat Apr 25 05:11:13 PDT 2015


Hi, Robert,

I have just stumbled on small issue in my intersection code which turned
out to be related to different interpretation of r2 param returned by
LineSegment::intersect( BoundingBox, r1, r2 ) and LineSegment::intersect(
BoundingSphere, r1, r2 ).

Example Code:

osg::BoundingBox box( -1,-1,-1, 1, 1, 1 );
osg::BoundingSphere sphere( box );
osg::ref_ptr< osg::LineSegment > diagonal = new osg::LineSegment( box._min,
box._max );

double box_r1, box_r2;
diagonal->intersect( box, box_r1, box_r2 );

double sphere_r1, sphere_r2;
diagonal->intersect( sphere, sphere_r1, sphere_r2 );

printf( "Box r1=%.0f r2=%.0f   Sphere r1=%.0f r2=%.0f \n", box_r1, box_r2,
sphere_r1, sphere_r2 );

Output:

Box r1=0 r2=0   Sphere r1=0 r2=1

Is that a bug or deliberate design ?

Cheers,
Wojtek Lewandowski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150425/b4332090/attachment-0001.htm>


More information about the osg-users mailing list