[osg-users] problem with PolytopeIntersector and double

suneel suresh compressor at gmail.com
Mon Apr 4 17:26:22 PDT 2011


Hi,

i have point picking implemented which works fine when i store the data as 
osg::Vec3Array and set it in the geometry as geometry->setVertexArray(vec3_vertArr)

But i choose to store it as a double, ie
osg::Vec3dArray and set it in the geometry as geometry->setVertexArray(vec3d_vertArr)

then point picking fails using the same PolytopeIntersector.
below is a the code for detecting the intersections


Code:

void PickHandler::pick(osgViewer::View* view, const osgGA::GUIEventAdapter& ea)
{
    const float x = ea.getX();
    const float y = ea.getY();
    const float look_offSet = 10.0f;    

    osg::ref_ptr<osgUtil::PolytopeIntersector> polyTopeIntersector = new osgUtil::PolytopeIntersector(osgUtil::Intersector::WINDOW, x - look_offSet , y - look_offSet, x + look_offSet, y + look_offSet );
    polyTopeIntersector->setDimensionMask(osgUtil::PolytopeIntersector::DimZero);    // only pick points

    osgUtil::IntersectionVisitor iv( polyTopeIntersector );
    view->getCamera()->accept( iv );    

    if (polyTopeIntersector->containsIntersections())  // some hits where found!
    {   
...
}
}




Whats the solution?

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








More information about the osg-users mailing list