Dear Shayne
I use polytope to pick the 3D coordinate of data.
……..
osg::ref_ptr<osgUtil::PolytopeIntersector> picker;
picker = new osgUtil::PolytopeIntersector(osgUtil::Intersector::WINDOW, x-w,
y-h, x+w, y+h );
osgUtil::IntersectionVisitor iv( picker );
viewer->getCamera()->accept( iv );
if(picker->containsIntersections())
{
………
}
I picked first point in 3D data and similarly the second point. The primitive
is set for these two points as LINES and a line gets drawn on screen.
osg::ref_ptr<osg::Vec3Array> points = new osg::Vec3Array;
osg::ref_ptr<osg::Vec4Array> color = new osg::Vec4Array;
osg::ref_ptr<Geometry> geometry( new osg::Geometry);
points->push_back(..get first x,y,z using osgUtil::PolytopeIntersector()…);
points->push_back(..get second x,y,z using osgUtil::PolytopeIntersector()…);
color->push_back(osg::Vec4(1.0,0.0,0.0,1.0));
geometry ->setVertexArray(points.get());
geometry ->setColorArray(color.get());
geometry ->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry ->addPrimitiveSet(new osg::DrawArrays(GL_LINES,0, points->size()));
I cannot use polytope in the area where there are no data points.
I think my line drawing procedure is wrong and this is why I am not able to do
so in those areas where there are no points.
A line can be anywhere, not necessarily through points, in this space for some
applications.
Thank you!
Cheers,
Lalit
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=44722#44722
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org