[osg-users] I want to know whether a line and a point intersect.
OpenSceneGraph Users
osg-users at lists.openscenegraph.org
Tue Nov 17 21:19:27 PST 2020
*I wrote it using a translator. Please understand if there is any
awkwardness in the sentence.*
One object is moving in the path A -> B, B->C, C-D (using AnimationPath).
And I need to know in what path the moving object is moving.
I think you need to know if the line and point intersect to figure this out.
I thought I should use LineSegmentIntersection to check whether a line and
a point intersect.
I found the part in LineSegmentIntersection that sets the line (path)
coordinates, but I don't find a function to check if the
LineSegmentIntersection and point intersect.
-------example--------
osg::Vec3d start(128.0, 37.0, 250); //wgs84, longitude, latitude,
altitude
osg::Vec3d end(128.0, 37.0005, 750); //wgs84, longitude, latitude, altitude
osg::ref_ptr<osg::Utill::LineSegmentIntersector> lis = NULL;
lis = new osgEarth::DPLineSegmentIntersector(start, end)
osgUtill::IntersectionVisitor iv(lis.get())
------------------------------------------
----------------------------------------------
osg::ref_ptr<osg::Node> node = _node
node->accept(iv);
if(lis->containsIntersections())
{
......................................
------------------------------------------------
I tried running it in the same way as above, but there was no true result
even though the object coordinates belong to the line coordinates.
I think the part of setting the point coordinates in that code is wrong.
How do I set the point coordinates to get the desired result?
--
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/ff9f8914-3012-4e37-85bf-ed286189c6e4n%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20201117/845d7168/attachment.html>
More information about the osg-users
mailing list