I believe both can be correct but it looks like in Box case r1 is ratio of
segment length measured from start and r2 measured backwards from the
segment end. For Sphere both r1 and r2 are measured from start. So here is
the inconsistency...
Cheers,
Wojtek

2015-04-27 12:38 GMT+02:00 Robert Osfield <robert.osfi...@gmail.com>:

> 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.lewandow...@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@lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to