<div dir="ltr">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...<div>Cheers,</div><div>Wojtek</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-27 12:38 GMT+02:00 Robert Osfield <span dir="ltr"><<a href="mailto:robert.osfield@gmail.com" target="_blank">robert.osfield@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Wojtek,<br>
<br>
Thanks for the test code. I've built it on my system with OSG<br>
svn/trunk and get the same values reported. The values don't look<br>
appropriate in either case, I don't know the cause of the issue yet so<br>
am doing a code review now.<br>
<br>
Robert.<br>
<br>
On 25 April 2015 at 13:11, Wojciech Lewandowski<br>
<div><div class="h5"><<a href="mailto:w.p.lewandowski@gmail.com">w.p.lewandowski@gmail.com</a>> wrote:<br>
> Hi, Robert,<br>
><br>
> I have just stumbled on small issue in my intersection code which turned out<br>
> to be related to different interpretation of r2 param returned by<br>
> LineSegment::intersect( BoundingBox, r1, r2 ) and LineSegment::intersect(<br>
> BoundingSphere, r1, r2 ).<br>
><br>
> Example Code:<br>
><br>
> osg::BoundingBox box( -1,-1,-1, 1, 1, 1 );<br>
> osg::BoundingSphere sphere( box );<br>
> osg::ref_ptr< osg::LineSegment > diagonal = new osg::LineSegment( box._min,<br>
> box._max );<br>
><br>
> double box_r1, box_r2;<br>
> diagonal->intersect( box, box_r1, box_r2 );<br>
><br>
> double sphere_r1, sphere_r2;<br>
> diagonal->intersect( sphere, sphere_r1, sphere_r2 );<br>
><br>
> printf( "Box r1=%.0f r2=%.0f Sphere r1=%.0f r2=%.0f \n", box_r1, box_r2,<br>
> sphere_r1, sphere_r2 );<br>
><br>
> Output:<br>
><br>
> Box r1=0 r2=0 Sphere r1=0 r2=1<br>
><br>
> Is that a bug or deliberate design ?<br>
><br>
> Cheers,<br>
> Wojtek Lewandowski<br>
><br>
</div></div>> _______________________________________________<br>
> osg-users mailing list<br>
> <a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
> <a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
><br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div><br></div>