[osg-users] LineSegmentIntersector

OpenSceneGraph Users osg-users at lists.openscenegraph.org
Tue Apr 14 15:27:22 PDT 2020


Hi,
I am having a lot of problems with picking with LineSegmentIntersector in 
OSG 3.6.5.

I have reduced the problem to a a simple cube, center 0.5,0.5,0.5 with a 
boundingSphere radius of 1.2142

I create the intersection with ( x , y are screen coordinates)

picker=new osgUtil::LineSegmentIntersector ( osgUtil::Intersector::WINDOW, x
, y );
osgUtil::IntersectionVisitor iv ( picker );
getCamera()->accept ( iv );



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.

When I "pull the camera back" from the geometry and the object is much 
smaller on the screen, the intersections fail.

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

Specifically I send up in

bool LineSegmentIntersector::intersects(const osg::BoundingSphere& bs)


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.

_start {_v=0x000001ba7308d300 {13.227287349450325, -2.9785854231569449, -
5.5167534692525066} }
_end {_v=0x000001ba7308d318 {11.072576448741074, -5.1332963238661939, -
7.6714332827528793} }

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.

Thx
Andrew

-- 
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/4fa21208-3ee7-45d7-a9cf-42a4b8a45d52%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200414/08494a30/attachment.html>


More information about the osg-users mailing list