Re: [osg-users] PolytopeIntersector "distance" and Transform
Hi, I'm also interested if you have a solution to easily pick points & lines ! Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52972#52972 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PolytopeIntersector "distance" and Transform
On Thu, Mar 7, 2013 at 4:53 AM, Robert Milharcic < robert.milhar...@ib-caddy.si> wrote: > On 4.3.2013 11:05, Andreas Roth wrote: > >> hanks to Aurelien for the work-around. >> > Hi Andreas, > > That is of course my personal opinion, but i think PolytopeIntersector is > overkill for most, if not all usage scenarios plus it doesn't work > correctly on a scaled geometry. I simply took LineSegmentIntersector > renamed it to IntersectorPrivate, added some sensitive area along picking > vector, added suport for lines, points etc... As I remember it, it was > pretty straight foward task... I'm not saying my solution is perfect nor > thoroughly tested but it works well for our needs. Of course if someone > would like to see what I did I can paste code here... The only reason we used the PI in osgEarth was to support line and point picking. So if you have a better solution that you are willing to share, we would be interested in evaluating it. Glenn Waldron / @glennwaldron ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PolytopeIntersector "distance" and Transform
On 4.3.2013 11:05, Andreas Roth wrote: hanks to Aurelien for the work-around. Hi Andreas, That is of course my personal opinion, but i think PolytopeIntersector is overkill for most, if not all usage scenarios plus it doesn't work correctly on a scaled geometry. I simply took LineSegmentIntersector renamed it to IntersectorPrivate, added some sensitive area along picking vector, added suport for lines, points etc... As I remember it, it was pretty straight foward task... I'm not saying my solution is perfect nor thoroughly tested but it works well for our needs. Of course if someone would like to see what I did I can paste code here... Robert Milharcic ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PolytopeIntersector "distance" and Transform
Hi, i tried to use the osgEarth::Picker class, which uses the PolytopeIntersector for picking and came across the same issue. I used Aurelien work-around and recalculate the distance, but as Aurelien already mentioned it's quite slow because of all the recalculation and sorting. Since Aurelien posted it's work-around more than a year has passed and i'm curious if there's are progress concerning this issue (i'm using 3.1.5 and the issue is still there). For now i'm happy with the work-around, but this not the best solution i think. Many thanks to Aurelien for the work-around. Regards, Andreas -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52947#52947 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PolytopeIntersector "distance" and Transform
Hi, Yes, I'm facing the same problem. I found a workaround by resorting intersections in a new container : for each intersection : - I compute the worldIntersectionPoint by transfoming the localIntersectionPoint in world coordinates - I compute the camera world position <-> worldIntersectionPoin distance It's a little slow, and it's only a workaround, but it works. Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44973#44973 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PolytopeIntersector "distance" and Transform
Peter Hrenka wrote: > > I had a partial fix which helped as long as there is no projection involved. > Unfortunately that is probably the main use-case... I think the proper way to > do this involves storing the inverse matrices in the result-structure and > back-transforming the intersection points before sorting. > Has anyone resolved this bug with incorrect "distance" reported by the PolytopeIntersector when objects are scaled? cheers, nick -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42907#42907 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PolytopeIntersector "distance" and Transform
Hi Peter, I have no time to work on this either at the moment. I will just avoid the scale transforms and scale the objects 'manually'. Andrew -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16108#16108 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PolytopeIntersector "distance" and Transform
Hi Andrew, Andrew Cunningham schrieb: Hi Peter, Did you ever work up a fix for this? ... I had a partial fix which helped as long as there is no projection involved. Unfortunately that is probably the main use-case... I think the proper way to do this involves storing the inverse matrices in the result- structure and back-transforming the intersection points before sorting. Right now I do not have much time to work on PolytopeIntersector, but if you want to fix it yourself I could describe my idea in more detail. It should not be hard (no hairy math involved). Thank you! Cheers, Andrew Cheers, Peter -- Vorstand/Board of Management: Dr. Bernd Finkbeiner, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Michel Lepert Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PolytopeIntersector "distance" and Transform
Hi Peter, Did you ever work up a fix for this? ... Thank you! Cheers, Andrew -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16056#16056 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PolytopeIntersector "distance" and Transform
Hi, Peter Thanks for looking into this a tricky bug ... I got really lost trying to trace the problem myself. good luck! I think as a workaround I will scale the geometry manually without using a transform. Andrew -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=14370#14370 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PolytopeIntersector "distance" and Transform
Hi Andrew, Andrew Cunningham schrieb: Hi Peter, Although your fix did not work - it is definitely the "scale" part of the transform causing the problem. If I remove the scaling part of the transform , then the polytope picking works as expected ... Thank you for the example. It turns out that transforming the "distance" plane is not so straight-forward after all when scaling is involved. I'll try to work out the proper transformation for that case. Cheers, Peter -- Vorstand/Board of Management: Dr. Bernd Finkbeiner, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Michel Lepert Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PolytopeIntersector "distance" and Transform
Hi Peter, Although your fix did not work - it is definitely the "scale" part of the transform causing the problem. If I remove the scaling part of the transform , then the polytope picking works as expected ... Andrew -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=14246#14246 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PolytopeIntersector "distance" and Transform
Hi again Andrew, Andrew Cunningham schrieb: Hi, I am having some problems with the "distance" found by the PolytopeIntersector but only when the geometry I am trying to pick has a non-null (Matrix)Transform in it's parent. The PolytopeIntersector registers that object as a 'hit', BUT the distance recorded appears to be incorrect ( the end result is I end up 'highlighting' the wrong object behind the object I want to pick). The intersection calculation works perfectly (with the transformed object) but the distance to the reference plane (used for sorting the intersections) does not accurately reflect the expected distance. Just to re-iterate this. As long as I do not try to pick a node with a transform, the sorting of the PolytopeIntersector works as expected Using the "LineSegmentIntersector" on the same scene does not show the issue. It correctly sorts the intersections. Any ideas? I had another look at the code and found a nasty surprise in Plane::transformProvidingInverse(). There is a call to Plane::makeUnitLength() in it which should totally screw distance results of PolytopeIntersector if you have any non-orthogonal Matrix-Transforms (i.e. scaling). Could you try commenting out this line and check if it works for you? If it does help I will think of a proper fix. Thanks Andrew Cheers Peter -- Vorstand/Board of Management: Dr. Bernd Finkbeiner, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Michel Lepert Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PolytopeIntersector "distance" and Transform
Hi Andrew, Andrew Cunningham schrieb: Hi, I am having some problems with the "distance" found by the PolytopeIntersector but only when the geometry I am trying to pick has a non-null (Matrix)Transform in it's parent. The PolytopeIntersector registers that object as a 'hit', BUT the distance recorded appears to be incorrect ( the end result is I end up 'highlighting' the wrong object behind the object I want to pick). The intersection calculation works perfectly (with the transformed object) but the distance to the reference plane (used for sorting the intersections) does not accurately reflect the expected distance. Just to re-iterate this. As long as I do not try to pick a node with a transform, the sorting of the PolytopeIntersector works as expected I had a look at the code but could not spot any obvious flaws. The Matrix-Transforms are handled in the method PolytopeIntersector::clone() and the reference-plane is transformed in sync with the Polytope. Using the "LineSegmentIntersector" on the same scene does not show the issue. It correctly sorts the intersections. Any ideas? Do your transformations have a scaling component? Thanks Andrew Cheers Peter -- Vorstand/Board of Management: Dr. Bernd Finkbeiner, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Michel Lepert Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org