Hi Gianni
Hi All,
I have a surface where a user can pick points. As suggested I used a Geode with 
Geometry built with osg::PrimitiveSet::POINTS and verteices. Then I used 
PointSprite to show an image on each point (but I think this is not really 
important).

Now I need to drag points with the mouse. First of all I have to handle the mouse 
move event to understand on which point the mouse is over. And now the problem. 
Given the mouse is over one of the previously picked points, how can I get which 
is the exact point of the Geometry from a osgUtil::PolytopeIntersector? The 
Intersection object contains a nodePath that at least refers to the Geometry node, 
not the single vertex/point. So I guess I have to loop over the actual picked 
points coordinates (i.e. geometry->getVertexArray()) and calculate the distance 
from the intersection.localIntersectionPoint. Is that right or is there a better 
way to implement it?
The LineSegIntersector will retrieve the primitive index and the vertex indices. There's some example in the OSG 3 Cookbook for this. This will save you the trouble iterating. I guess there is something similar for the polytope intersector, which at least will narrow down the number of vertices to check on your end. I've implemented some "level"-terrain tool where I used some of this stuff. Unfortunately I don't have the source code here, so I could check on this later if you need some more info

Cheers
Sebastian


Cheers,
Gianni

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61962#61962





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

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

Reply via email to