Re: [osg-users] Distance point to geometry
Hi Vincent, I'm not clear on what you are after, but I can say that there isn't anything close to resembling what you are talking about in the OSG so you'll need to roll your own visitor. Robert On 16 January 2012 08:36, Vincent Bourdier vincent.bourd...@gmail.com wrote: Hi all, Looking in the archives I didn't get any interesting answer so here is the question : Is there any way using OSG to compute the distance between a graph and a point ? (not just with the vertices but also with edges and the triangles) I could implement my own visitor to traverse all element (vertex, ege and face) but I'm looking for something more optimized or more easy to do in a few days if possible... Thanks. Regards, Vincent. -- ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Distance point to geometry
Hi Robert, Sorry if I was not clear : I'm just looking for a way to compute the smallest distance between a point and a geometry, not just a point to vertex distance, but also a point to edge or point to face (orthogonal projection). Due to the few days I have I think this won't be possible and safe... Thanks. Regards, Vincent. Le 16/01/2012 10:26, Robert Osfield a écrit : Hi Vincent, I'm not clear on what you are after, but I can say that there isn't anything close to resembling what you are talking about in the OSG so you'll need to roll your own visitor. Robert On 16 January 2012 08:36, Vincent Bourdiervincent.bourd...@gmail.com wrote: Hi all, Looking in the archives I didn't get any interesting answer so here is the question : Is there any way using OSG to compute the distance between a graph and a point ? (not just with the vertices but also with edges and the triangles) I could implement my own visitor to traverse all element (vertex, ege and face) but I'm looking for something more optimized or more easy to do in a few days if possible... Thanks. Regards, Vincent. -- ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Distance point to geometry
Vincent Bourdier vincent.bourd...@gmail.com writes: Hi Robert, Sorry if I was not clear : I'm just looking for a way to compute the smallest distance between a point and a geometry, not just a point to vertex distance, but also a point to edge or point to face (orthogonal projection). That is a common problem in robotics and computational geometry. This should get you started with a choice of algorithms that might suit you: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.46.8005rep=rep1type=pdf Cheers, Philipp Moeller Due to the few days I have I think this won't be possible and safe... Thanks. Regards, Vincent. Le 16/01/2012 10:26, Robert Osfield a écrit : Hi Vincent, I'm not clear on what you are after, but I can say that there isn't anything close to resembling what you are talking about in the OSG so you'll need to roll your own visitor. Robert On 16 January 2012 08:36, Vincent Bourdiervincent.bourd...@gmail.com wrote: Hi all, Looking in the archives I didn't get any interesting answer so here is the question : Is there any way using OSG to compute the distance between a graph and a point ? (not just with the vertices but also with edges and the triangles) I could implement my own visitor to traverse all element (vertex, ege and face) but I'm looking for something more optimized or more easy to do in a few days if possible... Thanks. Regards, Vincent. -- ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Distance point to geometry
Hi Robert, Le 16/01/2012 10:53, Robert Osfield a écrit : You'd implement a NearestGeometryIntersector that holds a point that you test your osg::Geometry against, using a osg::TriangleFunctor like the LineSegmentIntersector would allow you to simply the work down to just a test of the point against a triangle. To make things efficient you'll need to build in testing against the bounding volumes against the point to decide whether it's contains any points that could be closer than the current closest distance detected. Thanks for the idea I'll will start with that. How could I implement the test against bounding volumes ? Because it is a visitor, the intersect method will be called on each drawable if I understand it well. Ho can I use the Intersector base to make a previous sort to keep only the nearest geometries or drawable base, before having the triangle functor traversing the datas ? Thanks. Regards, Vincent. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Distance point to geometry
Hi Robert, Thanks for you help. I think I can do something not so bad with that. Regards, Vincent. Le 16/01/2012 20:04, Robert Osfield a écrit : Hi Vincent, On 16 January 2012 14:55, Vincent Bourdiervincent.bourd...@gmail.com wrote: Thanks for the idea I'll will start with that. How could I implement the test against bounding volumes ? Have a look how src/osgUtil/InteresectionVisitor.cpp interacts with the osgUtil::Intersector that is assigned to it, and at the same time see how LineSegmentIntersectio/PolytopeIntersection etc implements the various functions that InversectionVisitor.cpp calls. Because it is a visitor, the intersect method will be called on each drawable if I understand it well. It does a bit more than that. The Intersection traversal has does intersections tests against bounding spheres, does reprojection of the intersector into the local coordinate frame beneath transforms. Ho can I use the Intersector base to make a previous sort to keep only the nearest geometries or drawable base, before having the triangle functor traversing the datas ? It's up to you how you want to manage this. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org