[osg-users] intersection tests
Trajce Nikolov NICK
trajce.nikolov.nick at gmail.com
Sat Feb 18 13:25:00 PST 2017
yes ...
Now, digging into the bits of the
IntersectionVisitor::apply(osg::Transform& transform) I am seeing it it
keeps a stack of the ModelMatrices and they are correct, as the visitor
traverse the scene it premult the matrices from the MatrixTransforms, to
this is ok .... the code (the osg code) looks just perfect to me just there
is a small bug sitting somewhere :)
On Sat, Feb 18, 2017 at 10:19 PM, Julien Valentin <
julienvalentin51 at gmail.com> wrote:
> Hi nick
> okay you're casting ray in world coordinates on model in world
> coordinates...
> I haven't understood....
> Then You should not consider the CoordinateFrames as matrix are the same.
> After a look at osgViewer::View::comuteIntersections i noticed
> intersecrionvisitor is created by this line
>
> Code:
> osg::ref_ptr< osgUtil::LineSegmentIntersector > picker = new osgUtil::
> LineSegmentIntersector(osgUtil::Intersector::MODEL, startVertex,
> endVertex);
>
>
> Perhaps your problem came from here...
>
> cheers
>
>
> Trajce Nikolov NICK wrote:
> > Thanks Julien for your time to give it a look
> >
> > I went further, debugging view->computeIntersections(). The osgpick is
> my starting point and my code is only a mimic of what osgViewer::View::computeIntersection
> is doing, using the IntersectionVisitor
> >
> >
> > A good sample for reproduction is to have some code (I will post it here
> soon) that will load two models (terrain and building - can be the lz.osg
> and the cow.osg from the dataset) place the model somewhere on the terrain
> and rotate the root (the terrain) a bit, and use the osgpick sample. This
> is fast that come to me minds now, although it might not work the same
> since picking from the screen coords and picking in "world space" have
> different CoordinateFrames for the LineSegmentIntersector used that is
> managed differently
> >
> >
> > On Sat, Feb 18, 2017 at 9:33 PM, Julien Valentin < ()> wrote:
> >
> > > Hi nick
> > > At first glance, I don't see any problem with your code...
> > > If you just want to code a mousepicker
> > > osgViewer::View::computeIntersections(screenx,
> screeny,outintersections))
> > > would fit your needs.
> > >
> > > Code:
> > > // class to handle events with a pick
> > > class PickHandler : public osgGA::GUIEventHandler
> > > {
> > > public:
> > > bool PickHandler::handle(const osgGA::GUIEventAdapter&
> ea,osgGA::GUIActionAdapter& aa)
> > > {
> > > switch(ea.getEventType())
> > > {
> > > case(osgGA::GUIEventAdapter::DOUBLECLICK):
> > > {
> > > osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
> > > if (view){
> > > osgUtil::LineSegmentIntersector::Intersections inter;
> > > if(view->computeIntersections(ea.getX(),ea.gety(),inter){
> > > ...blablabla...
> > > }
> > > }
> > > }
> > >
> > >
> > >
> > >
> > > Perhaps you should try it before debugging deeper
> > >
> > > Further, I would recommend the polytopeintersector for general purpose
> picking (it works for points primitives too)
> > >
> > > Hope it helps
> > >
> > >
> > > Cheers
> > >
> > >
> > >
> > > Trajce Nikolov NICK wrote:
> > >
> > > > It has to do with MatrixTransforms and probably the
> IntersectionVisitor. I had my scene rotated a bit and it was buggy. With
> identity matrix on top works well ... Trying to debug if I can find
> something
> > > >
> > > > On Thu, Feb 16, 2017 at 8:31 PM, Trajce Nikolov NICK < ()> wrote:
> > > >
> > > >
> > > > > Hi Community,
> > > > >
> > > > > I am experiencing some bad results from various intersection
> tests. I have a database with buildings and for some reason the
> intersection tests are failing to get me the roofs of the buildings ...
> > > > >
> > > > >
> > > > > Here some snippets of my tries:
> > > > >
> > > > >
> > > > > http://pastebin.com/s7aZk8wA (http://pastebin.com/s7aZk8wA) (
> http://pastebin.com/s7aZk8wA (http://pastebin.com/s7aZk8wA))
> > > > >
> > > > > http://pastebin.com/1s99SGZc (http://pastebin.com/1s99SGZc) (
> http://pastebin.com/1s99SGZc (http://pastebin.com/1s99SGZc))
> > > > >
> > > > > http://pastebin.com/UtkqPRce (http://pastebin.com/UtkqPRce) (
> http://pastebin.com/UtkqPRce (http://pastebin.com/UtkqPRce))
> > > > >
> > > > >
> > > > >
> > > > > What I am missing here?
> > > > >
> > > > >
> > > > > Thanks for every hint as always!
> > > > > Cheers!
> > > > >
> > > > > --
> > > > > trajce nikolov nick
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > trajce nikolov nick
> > > >
> > > > ------------------
> > > > Post generated by Mail2Forum
> > > >
> > >
> > >
> > > ------------------
> > > Read this topic online here:
> > > http://forum.openscenegraph.org/viewtopic.php?p=70269#70269 (
> http://forum.openscenegraph.org/viewtopic.php?p=70269#70269)
> > >
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > osg-users mailing list
> > > ()
> > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-
> openscenegraph.org (http://lists.openscenegraph.
> org/listinfo.cgi/osg-users-openscenegraph.org)
> > >
> >
> >
> >
> >
> > --
> > trajce nikolov nick
> >
> > ------------------
> > Post generated by Mail2Forum
>
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=70272#70272
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
--
trajce nikolov nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20170218/7bd2411a/attachment-0003.htm>
More information about the osg-users
mailing list