Hi Daniel,

The PolytopeIntersector is the simplest route.  If you want to make
things more efficient then you may well need to come up with a custom
approach.

The LineSegmentIntersector is able to take advantage of KdTree graphs
if they have been built for your scene graph and enables O(logn)
intersections instead of O(n), but unfortunately PolytopeIntersector
doesn't support KdTrees yet.  You are welcome to add it :-)

The other approach you could take is to break your dataset into
smaller chunks, such as dividing it into an octree so that the
internal nodes of the octree can be culled before only the bricks that
intersect the Polytope need to be tested exhaustively.

Robert.

Robert.

On 24 June 2016 at 16:06, Daniel Neos <daniel...@hotmail.de> wrote:
> Hi,
>
> I have a Pickhandler and a dynamically changing scene which consists only of 
> a geometry node. To be more specific, the geometry node represents a point 
> cloud consisting over ~100000 vertices.
>
> Using a line intersector makes it nearly impossible to get an intersection, 
> but the Intersector I am using, the polytopeintersector, needs ~200ms to get 
> an intersection, which is too long for my application. I need a 'smooth' 
> visualization of ~20-25fps and this would be definitley a bottleneck.
>
> Is there a more simple way to get intersections of a non-solid object fast?
>
> Here is my PickHandler. Input arguments in my application are the normalized 
> (x,y)coordinates from the GUIEventAdapter, buffer is the tolerance with 0.005 
> and the viewer casted from the ActionAdapter.
>
>
> Code:
>
> bool PickHandler::getPickedPoint(double x, double y, float buffer,
>     osgViewer::View* viewer)
> {
>  osg::ref_ptr<osgUtil::PolytopeIntersector> intersector(0);
>     try
>     {
>         intersector = new osgUtil::PolytopeIntersector(
>             osgUtil::Intersector::PROJECTION,
>             x - buffer, y - buffer, x + buffer, y + buffer);
>     }
>     catch (const std::bad_alloc&)
>     {
>         return false;
>     }
>
>     // DimZero = check only for points
>     intersector->setDimensionMask(osgUtil::PolytopeIntersector::DimZero);
>
>     intersector->setIntersectionLimit(osgUtil::Intersector::LIMIT_NEAREST);
>     osgUtil::IntersectionVisitor iv(intersector);
>     viewer->getCamera()->accept(iv);
>
>     if (intersector->containsIntersections())
>     {
>         osgUtil::PolytopeIntersector::Intersection intersection
>             = *(intersector->getIntersections().begin());
>
>         const osg::Vec3f& p = intersection.intersectionPoints[0];
>         m_point.set(p[0], p[1], p[2]);
>         return true;
>     }
>     return false;
>
>
>
>
> Thank you!
>
> Cheers,
> Daniel[/code]
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=67797#67797
>
>
>
>
>
> _______________________________________________
> 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