Roger that. T
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of J.P. Delport Sent: Friday 05 December 2008 07:10 To: OpenSceneGraph Users Subject: Re: [osg-users] computeIntersections Bug + Fix (was View::computeIntersections with a node path) Hi, could you please send the complete file to osg-submissions. See here http://www.openscenegraph.org/projects/osg/wiki/MailingLists/Submissions Protocol jp Tanguy Fautre wrote: > Hi, > > I think I found the bug. Fixed implementation attached. > > If you look at the implementation of the function osgViewer::View::computeIntersections() taking the nodepath argument, you'll see that it compute the LocalToWorld transformation using the complete given path. > > But this is incorrect if the last node of the path is a transformation. In which case the last transformation is applied twice before computing any intersections. > > I've currently copy/pasted the current implementation and changed it to a standalone function so that I could test and use it as a fixed version without modifying OSG code. See attachment. > > > The two important lines are: > > const osg::NodePath shortPath(nodePath.begin(), nodePath.end() - 1); > > osg::Matrix matrix = osg::computeLocalToWorld(shortPath) * camera->getViewMatrix() * camera->getProjectionMatrix(); > > > Robert, if you agree with these modifications, what should I do for them to be integrated back into the trunk? > > > Cheers, > > Tanguy > > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tanguy Fautre > Sent: Friday 28 November 2008 15:21 > To: osg-users@lists.openscenegraph.org > Cc: Neil Groves > Subject: Spam: [osg-users] View::computeIntersections with a node path > > Hi, > > Has anyone been able to successfully use > osgViewer::View::computeIntersections() taking a node path argument on a > non-trivial scenegraph? > > I currently have a fairly complex scenegraph, but I only want a small > part of it to collide with computeIntersections. When I use > computeIntersections without the nodepath, everything works perfectly. > But as soon as I use the overload with the node path, I get an empty > intersection set. I'm pretty sure the node path I'm giving is correct. > > Looking at the implementation of computeIntersections() with the node > path, the only thing that puzzles me is the use of > osg::computeWorldToLocal(nodePath) before computing the matrix inverse, > I'm not sure I fully understand why this is the case. It seems to me the > whole operation should be LocalToWorldMatrix * ViewMatrix * > ProjectionMatrix instead. > > In any case, if anyone has a working example (which would show > computeIntersections() with a node path is working correctly, or help > finding the mistake I'm doing), it would be appreciated. > > > Regards, > > Tanguy > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g > > > ------------------------------------------------------------------------ > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org