Hi Sonya,
Hi All and Thanks for your feedback,
Please find the reproduced example and obj file at the attachment, it
doesn't have any visual aids,
with 1st user click program creates leftbottom of rectangle, second
user click creates righttop,
for intersection rectangle and invokes PolytopeIntersector. If I
select them all I'd expect totally 5
objects to be picked, but program produces 420. There is a high
chance that as Sebastian Messerschmidt
emphasized, I pick all vertices but can you confirm it ?
Sorry I cannot do the debugging for you. I'd attach a debugger and check
what I get back from the interface.
> Admittedly, the current behaviour is of PolytopeIntersector is not
very space- or time-efficient
> for your use-case. I think a useful extension would be some kind of
"only-first-intersection"-flag
> which should reduce the number of generated intersecions for cases
like yours.
I'm bit confused here, its a common practice to use rectangular,
polygonal circle area selection in
3D applicaitons (e.g. Blender),that is even been suggested by the OSG
Beginner book Chapter 9
"Have a go hero -- selecting geometries in a rectangular region" the
proper usage is POlytopeIntersector.
It is fast enough for most use cases I've encountered. It is a general
implementation and not necessarily the most efficient one - so if you
encounter performance issues you can always write your own intersector
implementation, so there is no need for confusion :-)
Regards,
> Date: Wed, 6 Aug 2014 09:43:14 +0200
> From: [email protected]
> To: [email protected]
> Subject: Re: [osg-users] [MASSMAIL] Erratical behaviour with
PolytopeIntersector
>
> Hello,
>
> On 08/04/2014 11:18 AM, Sonya Blade wrote:
> > Dear All,
> >
> > I'm experiencing very weird problem when using the polytope
intersector. Since there is not any explicit example on how
> > to use polytope example with rectangular selection I use osgPick
example in OSG and modify the codes to suit my need.
>
> The canonical example for PolytopeIntersector is osgkeyboardmouse
which shows one possible usage.
>
> > Normally the below code picks the objects on scene but shows that
400 picked objects which is not correct and far beyond of
> > scene object range where that I have, I only have 5-6 object in
scene,
>
> As Sebastian Messerschmidt has suggested the PolytopeIntersector
returns intersections on
> a per-primitive level and that also includes all primitives inside
the polytope.
>
> If you only want results on a higher level (e.g. per drawable) you
can just modify
> the counting loop in you code to eliminate duplicate drawables.
>
> Admittedly, the current behaviour is of PolytopeIntersector is not
very space- or time-efficient
> for your use-case. I think a useful extension would be some kind of
"only-first-intersection"-flag
> which should reduce the number of generated intersecions for cases
like yours.
>
>
> Cheers,
>
> Peter
>
> > What could be the reason of that malfunctioning ? I 'll appreciate
your guidance on that !.
> >
> > case (osgGA::GUIEventAdapter::RELEASE):
> > {
> > if (btn_counter == 1 )
> > {
> > firstX = ea.getX(); firstY = ea.getY();
> > btn_counter = 2;
> > break;
> > }
> >
> > if (btn_counter==2)
> > {
> > btn_counter = 1;
> > osgUtil::PolytopeIntersector* polytop = new
osgUtil::PolytopeIntersector( osgUtil::Intersector::WINDOW,
firstX,firstY, ea.getX(), ea.getY() );
> > osgUtil::IntersectionVisitor iv(polytop);
> > view->getCamera()->accept(iv);
> >
> > int k;
> > if (polytop->containsIntersections() )
> > {
> >
> > osgUtil::PolytopeIntersector::Intersections intersections=
polytop->getIntersections();
> > osg::Vec3 screenpos = osg::Vec3(ea.getX(),ea.getY(),0);
> >
> > for(osgUtil::PolytopeIntersector::Intersections::iterator hitr =
intersections.begin();
> > hitr != intersections.end(); ++hitr)
> > {
> > k+=1;
> > std::cout<< k << "----" << hitr->drawable->getName()<<
hitr->drawable->className()<<"\n" ;
> >
> > }
> > }
> > }
> > }
> > }
> > }
> > };
> >
> >
> >
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> >
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
>
> _______________________________________________
> osg-users mailing list
> [email protected]
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org