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

Robert Osfield robert.osfield at gmail.com
Mon Apr 27 04:28:47 PDT 2015

Hi Wojtek,

On 27 April 2015 at 12:15, Wojciech Lewandowski
<w.p.lewandowski at gmail.com> wrote:
> 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...

This is my assessment too.

I have #if def'd out the LineSegment::intersect(const BoundingBox&
bb,float& r1,float& r2) style methods from LineSegment and have been
able to compile the whole OSG, so it looks like these methods have
been written but not used and tested by the OSG itself so the errors
haven't been picked up.

This leaves us with deciding what to do with these erroneous methods.
One route is to remove them, another is to change their behaviour so
it's consistent and document this change.  To make the method
consistent I feel that they should return the ratio between the start
and end points, measured from the start.

I am little concerned that some end user code will be using these
intersects methods and working around their inconsistency, so if we
fix them then we could end up breaking end user code.


More information about the osg-users mailing list