Hi Peter, thank you for the fast reply. I need some clarifications about question 1. In my application I will use the "picked" point to calculate, and then show, the arclength of a path, i.e. the length of the path from start to the picked point. So I would not need to show coordinates to the user. So I guess WINDOW or PROJECTION would be the same for my case. But I would like to understand why I get different coordinates from "intersection.localIntersectionPoint" with osgUtil::Intersector::WINDOW wrt osgUtil::Intersector::PROJECTION
Here is a code snippet as an example: Code: osgUtil::PolytopeIntersector* picker; { osg::Viewport* viewport = viewer->getCamera()->getViewport(); double mx = viewport->x() + (int)((double )viewport->width()*(ea.getXnormalized()*0.5+0.5)); double my = viewport->y() + (int)((double )viewport->height()*(ea.getYnormalized()*0.5+0.5)); double w = 5.0f; double h = 5.0f; picker = new osgUtil::PolytopeIntersector( osgUtil::Intersector::WINDOW, mx-w, my-h, mx+w, my+h ); osgUtil::IntersectionVisitor iv(picker); viewer->getCamera()->accept(iv); if (picker->containsIntersections()) { osgUtil::PolytopeIntersector::Intersection intersection = picker->getFirstIntersection(); std::cout << "osgUtil::Intersector::WINDOW " << intersection.localIntersectionPoint.x() << " " << intersection.localIntersectionPoint.y() << " " << intersection.localIntersectionPoint.z() << std::endl; } } { double mx = ea.getXnormalized(); double my = ea.getYnormalized(); double w = 0.05; double h = 0.05; picker = new osgUtil::PolytopeIntersector( osgUtil::Intersector::PROJECTION, mx-w, my-h, mx+w, my+h ); osgUtil::IntersectionVisitor iv(picker); viewer->getCamera()->accept(iv); if (picker->containsIntersections()) { osgUtil::PolytopeIntersector::Intersection intersection = picker->getFirstIntersection(); std::cout << "osgUtil::Intersector::PROJECTION " << intersection.localIntersectionPoint.x() << " " << intersection.localIntersectionPoint.y() << " " << intersection.localIntersectionPoint.z() << std::endl; } } And I get an output like this: osgUtil::Intersector::WINDOW 18.8821 0.0163024 0 osgUtil::Intersector::PROJECTION 31.7343 0.0274029 0 osgUtil::Intersector::WINDOW 18.8821 0.0163024 0 osgUtil::Intersector::PROJECTION 31.7343 0.0274029 0 osgUtil::Intersector::WINDOW 22.529 0.019452 0 osgUtil::Intersector::PROJECTION 34.8797 0.0301198 0 The WINDOW case shows different coordinates (look at X coordinate please) wrt PROJECTION case, but they does not seem to be one in pixel and the other normalized. Am I missing something? Moreover in the WINDOW case I need to be closer to the geomwetry to get a valid intersection. Can you explain me please why? Best regards, Gianni ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61495#61495
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org