<div dir="ltr"><div>In my case its Perspective.</div><div><br></div><div><br></div><div>I was able to work around the problem by using a PolyTope intersector with a 1x1 rectangle. That worked perfectly.<br></div><br>On Tuesday, April 14, 2020 at 11:56:24 PM UTC-7, OpenSceneGraph Users wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir="ltr"><div>Hi Andrew,</div><div><br></div><div>When you say you have a isometric view, to be clear, you mean you have an orthographic projection of the scene?  The OSG itself support orthographic projection via the osg::Camera's ProjectionMatrix, the intersection.  It can only account for this if the IntersectionVisitor knows about it's setting.  <br></div><div><br></div><div>Have you tried the osgViewer::View(er)::<wbr>computeIntersections(..) method?</div><div><br></div><div>This method knows about the View's Camera so can account for it's projection matrix.<br></div><div><br></div><div>Robert.<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, 14 Apr 2020 at 23:35, OpenSceneGraph Users <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="XGldYnrSBwAJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">osg-...@lists.<wbr>openscenegraph.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div>I am having a lot of problems with picking with LineSegmentIntersector in OSG 3.6.5.</div><div><br></div><div> </div><div>I have reduced the problem to a a simple cube, center 0.5,0.5,0.5 with a boundingSphere radius of 1.2142</div><div><br></div><div>I create the intersection with ( x , y are screen coordinates)</div><div><br></div><div style="background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px"><code><div><span style="color:rgb(0,0,0)">picker</span><span style="color:rgb(102,102,0)">=</span><span style="color:rgb(0,0,136)">new</span><span style="color:rgb(0,0,0)"> osgUtil</span><span style="color:rgb(102,102,0)">::</span><span style="color:rgb(102,0,102)">LineSegmentIntersecto<wbr>r</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)"> osgUtil</span><span style="color:rgb(102,102,0)">::</span><span style="color:rgb(102,0,102)">Intersector</span><span style="color:rgb(102,102,0)">::</span><span style="color:rgb(0,0,0)">WINDOW</span><span style="color:rgb(102,102,0)">,</span><span style="color:rgb(0,0,0)"> x</span><span style="color:rgb(102,102,0)">,</span><span style="color:rgb(0,0,0)"> y </span><span style="color:rgb(102,102,0)">);</span><span style="color:rgb(0,0,0)"><br>osgUtil</span><span style="color:rgb(102,102,0)">::</span><span style="color:rgb(102,0,102)">IntersectionVisitor</span><span style="color:rgb(0,0,0)"> iv </span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)"> picker </span><span style="color:rgb(102,102,0)">);</span><span style="color:rgb(0,0,0)"><br>getCamera</span><span style="color:rgb(102,102,0)">()-></span><span style="color:rgb(0,0,0)">accept </span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)"> iv </span><span style="color:rgb(102,102,0)">);</span><span style="color:rgb(0,0,0)"><br><br></span></div></code></div><div><br><br></div><div>When I am "close" to the model geometry in an isometric view ( the cube fills,say, 50% of the screen), this works perfectly. I get the exact intersections coordinates I expect.</div><div><br></div><div>When I "pull the camera back" from the geometry and the object is much smaller on the screen, the intersections fail.</div><div><br></div><div>After much debugging, the problem is that the intersector fails the test of the intersection of the line with the bounding sphere of my model geometry</div><div><br></div><div>Specifically I send up in</div><div><br></div><div> <div style="background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px"><code><div><span style="color:rgb(0,0,136)">bool</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,0,102)">LineSegmentIntersector</span><span style="color:rgb(102,102,0)">::</span><span style="color:rgb(0,0,0)">inters<wbr>ects</span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,136)">const</span><span style="color:rgb(0,0,0)"> osg</span><span style="color:rgb(102,102,0)">::</span><span style="color:rgb(102,0,102)">BoundingSphere</span><span style="color:rgb(102,102,0)">&</span><span style="color:rgb(0,0,0)"> bs</span><span style="color:rgb(102,102,0)">)</span></div></code></div><br></div><div><br></div><div>The BoundingSphere is in "model space" , and correct, but the _start and _end points used in the calculation are incorrect to intersect the sphere in model space and so the intersection fails.<br></div><div><br></div><div><div style="background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px"><code><div><span style="color:rgb(0,0,0)">_start </span><span style="color:rgb(102,102,0)">{</span><span style="color:rgb(0,0,0)">_v</span><span style="color:rgb(102,102,0)">=</span><span style="color:rgb(0,102,102)">0x000001ba7308d300</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">{</span><span style="color:rgb(0,102,102)">13.227287349450325</span><span style="color:rgb(102,102,0)">,</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">-</span><span style="color:rgb(0,102,102)">2.9785854231569449</span><span style="color:rgb(102,102,0)">,</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">-</span><span style="color:rgb(0,102,102)">5.5167534692525066</span><span style="color:rgb(102,102,0)">}</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">}</span><span style="color:rgb(0,0,0)"><br>_end </span><span style="color:rgb(102,102,0)">{</span><span style="color:rgb(0,0,0)">_v</span><span style="color:rgb(102,102,0)">=</span><span style="color:rgb(0,102,102)">0x000001ba7308d318</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">{</span><span style="color:rgb(0,102,102)">11.072576448741074</span><span style="color:rgb(102,102,0)">,</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">-</span><span style="color:rgb(0,102,102)">5.1332963238661939</span><span style="color:rgb(102,102,0)">,</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">-</span><span style="color:rgb(0,102,102)">7.6714332827528793</span><span style="color:rgb(102,102,0)">}</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">}</span></div></code></div><br>Any ideas what is going on. It seems although the vector of start and end is the correct vector ( or the "closer" picking would not work), something is wrong in the transformation into model space.</div><div><br></div><div>Thx</div><div>Andrew<br></div></div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="XGldYnrSBwAJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">osg-...@<wbr>googlegroups.com</a>.<br>
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/osg-users/4fa21208-3ee7-45d7-a9cf-42a4b8a45d52%40googlegroups.com?utm_medium=email&utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/msgid/osg-users/4fa21208-3ee7-45d7-a9cf-42a4b8a45d52%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter';return true;" onclick="this.href='https://groups.google.com/d/msgid/osg-users/4fa21208-3ee7-45d7-a9cf-42a4b8a45d52%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter';return true;">https://groups.google.com/d/<wbr>msgid/osg-users/4fa21208-3ee7-<wbr>45d7-a9cf-42a4b8a45d52%<wbr>40googlegroups.com</a>.<br>
______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="javascript:" target="_blank" gdf-obfuscated-mailto="XGldYnrSBwAJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">osg-...@lists.<wbr>openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Flists.openscenegraph.org%2Flistinfo.cgi%2Fosg-users-openscenegraph.org\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEhxcobqaKtkSCnaCeBWJ1fFl93mw';return true;" onclick="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Flists.openscenegraph.org%2Flistinfo.cgi%2Fosg-users-openscenegraph.org\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEhxcobqaKtkSCnaCeBWJ1fFl93mw';return true;">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
</blockquote></div>
</blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:osg-users+unsubscribe@googlegroups.com">osg-users+unsubscribe@googlegroups.com</a>.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/osg-users/440a9e5d-63e3-40d0-abed-490ca18a311d%40googlegroups.com?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/osg-users/440a9e5d-63e3-40d0-abed-490ca18a311d%40googlegroups.com</a>.<br />