2009/12/3 Fred Smith <osgfo...@tevs.eu>

> Hi,
>
> On one occasion I don't get two intersections, only one. That's the
> problem.
>
> I expect two intersections. One for the first triangle, one for the second.
> I get only one, for the second triangle, even though I picked the left
> triangle.
>
> You can easily reproduce this with the OSG file I listed.
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=20825#20825
>
>
This bug is due to the geometry being 2D and the actual intersection being
calculated w/ floats.

If you need a quick and dirty fix, you can change the code in

void TriangleIntersector::operator () (...)
 [[ src\osgUtil\LineSegmentIntersector.cpp ]]

To use doubles instead.


I was going to make a submission for that, but I've been busy and
this issue may benefit from a bit of discussion, rather than just changing
the code to use doubles.

Basically it boils down the fact that when the geometry is entirely 2d,
there is some code in
   bool LineSegmentIntersector::intersectAndClip(...)
which expands the bounding box, leaving it just  1e-4 across in the thin
direction.

When you have vertices out at larger coordinates (> ~4000) the
intersection code starts hitting numeric precision problems.

So you can either go with doubles, change the size of the expansion of
the bounding box (and then hit precision issues again at some point in the
future),
add some sort of approximate floating point compare code or maybe don't clip
the pick ray to the bounding box when there is 2D geometry.

-- 
http://www.ssTk.co.uk
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to