Hi everybody
I have a question about intersection. I try to intersect lines with the
osgUtil::PolytopeIntersector class. This works fine.
Now how can i get the picked line from the picked geometry? I want to have the
two vertices from the picked line...
Thanks a lot!
Daniel
My Code for intersection;
osg::NodePath& nodePath = intersection.nodePath;
node = nodePath.back();
if ( node.valid() ) {
std::cout << " Hits ";
std::cout << node->className();
std::cout << " - NodePath size: ";
std::cout << nodePath.size();
std::cout << std::endl;
osg::ref_ptr<osg::Geode> pickedGeode =
dynamic_cast<osg::Geode *>(node.get());
osg::ref_ptr<osg::Drawable> pickedDrawable =
pickedGeode->getDrawable(0);
osg::ref_ptr<osg::Geometry> pickedGeometry =
dynamic_cast<osg::Geometry*> (pickedDrawable.get());
osg::ref_ptr<osg::Vec3Array> pickedVertexArray =
dynamic_cast<osg::Vec3Array*> (pickedGeometry->getVertexArray());
std::cout << " -> Num of Triangles: ";
std::cout <<
pickedGeometry->getPrimitiveSet(0)->getNumPrimitives();
std::cout << std::endl;
std::cout << " -> Used Vertices: ";
std::cout <<
pickedGeometry->getPrimitiveSet(0)->getNumIndices();
std::cout << std::endl;
std::cout << " -> Number of Vertices from the Geometry: ";
std::cout << pickedVertexArray->getNumElements();
std::cout << std::endl;
}
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org