[osg-users] Newbie question #1: How to get

TANG Fangqin fqtang at gmail.com
Mon Sep 8 05:25:29 PDT 2008


Hi Karl,

You may use the LineSegmentIntersector to compute the intersections with
your model, then can get the coordinates of the corresponding point.

The codes may be like this:

 // Use the LineSegmentIntersector to compute intersections
 osgUtil::LineSegmentIntersector::Intersections intersections;
 if(viewer->computeIntersections(ea.getX(),ea.getY(), intersections))
 {
  if(intersections.size() > 0)
  {
   osgUtil::LineSegmentIntersector::Intersections::iterator
    hitr =intersections.begin();

   // return the intersect point in world coordinate system
   vec = hitr->getWorldIntersectPoint();
   return true;
  }
Hope this works.

Best regards,
Fangqin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080908/64570a47/attachment-0003.htm>


More information about the osg-users mailing list