Hello Andrew,

I am trying to implement something like this, in order to compute hit tests on a line. I don't need to know which objects intersected the line, or get a list of objects/intersections out, just need to know "Is there an intersection or not".

The original posts are included below. Would anyone know how I might go about implementing this?

I think I had mentioned the files to check in that thread, but if not, have a look at the code in osgUtil::IntersectionVisitor, osgUtil::LineSegmentIntersector and associated classes (some of which are in the source files only). It should be pretty simple to use those as guidance and just return true whenever it can be decided without error that the intersection will succeed. Also if you remove all the calculations that are done in the case an intersection was successful (node path copy, local intersection point and normal, etc.) you might gain a bit too.

Note that if you can survive by doing an approximate test, then you could also implement your own subclasses of LineSegmentIntersector/IntersectionVisitor that would only check bounding volumes. That would be much quicker than testing the geometry. If you do need exact tests, then make sure you enable kd-trees for your geometries, this will help greatly.

If you end up doing this, please do it in a way that can be re-integrated into OSG since I expect other people will be interested in using this kind of test.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    [email protected]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to