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

Robert Osfield robert.osfield at gmail.com
Mon Apr 27 03:38:32 PDT 2015


Hi Wojtek,

Thanks for the test code.  I've built it on my system with OSG
svn/trunk and get the same values reported.  The values don't look
appropriate in either case, I don't know the cause of the issue yet so
am doing a code review now.

Robert.

On 25 April 2015 at 13:11, Wojciech Lewandowski
<w.p.lewandowski at gmail.com> wrote:
> 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
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list