[osg-users] osgUtil::PolytopeIntersector finding the closest intersection

Peter Hrenka p.hrenka at science-computing.de
Mon Oct 1 23:56:18 PDT 2007

Hi Michele,

Michele Bosi wrote:
> Hi all,
> my program needs to select some lines, since
> osgViewer->computeIntersections is unable to pick lines I switched to
> osgUtil::PolytopeIntersector which is able to do so. Unfortunately
> PolytopeIntersector seems unable to tell me the intersection
> points/lines from which I would determine the closest object that I
> actually picked (among all the other that intersect the picking
> volume). Am I missing something? hope so.

In the current state the PolytopeIntersector does not store intersection 
points or primitive indices. I do have a version that does so, but it
needs some cleanup before I am willing to submit it. Right now I do not
have much time but I hope that can submit a version next week.

> To sum up, is there a way to determine the closest object picked by a
> osgUtil::PolytopeIntersector (actually not the closest object but the
> one which has the closest intersection)? Or, are there other ways to
> pick a line object?

That's exactly what my enhancement of the PolytopeIntersector does.
It uses a "reference plane" and sorts the intersections according
to the distance to that reference plane.

Of course there are other ways to pick lines: One could use cylinders
or cones which surround the pick-ray for intersecting lines but this is 
not implemented within OpenSceneGraph (yet).

> Regards,
> Michele


> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

________________________________creating IT solutions
Peter Hrenka                    science + computing ag
Software Solutions              Hagellocher Weg 73
phone +49 7071 9457 263         72070 Tuebingen, Germany
fax   +49 7071 9457 511
p.hrenka at science-computing.de   www.science-computing.de
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Florian Geyer,
Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Prof. Dr. Hanns Ruder
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196 

More information about the osg-users mailing list