Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Getting index of facet closest to a point
- Date: Mon, 03 Jun 2013 07:57:39 +0200
- Organization: GeometryFactory
pp.second is an iterator in the container containing the triangles.
You can for example, change std::list<Triangle_3> to
std::vector<Triangle_3> and use std::distance(triangles.begin(),
pp.second) to get the index.
Sebastien.
On 06/01/2013 02:02 AM, rcasero wrote:
Dear all,
I have a triangulation and I'm trying to find the closest facet to a point
using an AABB tree, but after much googling, and unsuccessfully trying to
find the methods available to facets in the CGAL source code, I'd like to
ask for a hand here.
I tinkered with the code in the manual, "64.3.3 Tree of Polyhedron
Triangle Facets for Distance Queries"
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/AABB_tree/Chapter_main.html#Subsection_64.3.3
and "64.3.1 Tree of Triangles, for Intersection and Distance Queries"
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/AABB_tree/Chapter_main.html#Subsection_64.3.1
I am able to compile and run the code, but what I've been unable to do is
once I get to this
Point_and_primitive_id pp = tree.closest_point_and_primitive(query);
Primitive f = pp.second; // closest primitive id
how to get an index to the facet (triangle) that is closest to the point.
That is, if I have created my triangulation with something like this, using
10 triangles
for (int i = 0; i< 10; ++i) {
// read a triangle
x0 = ...
x1 = ...
x2 = ...
// add triangle to the list of triangles in the surface
triangles.push_back(Triangle(x0, x1, x2));
}
how I can tell from pp.second above which of the 10 triangles is the
solution.
Best regards,
Ramon.
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Getting-index-of-facet-closest-to-a-point-tp4657635.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Getting index of facet closest to a point, rcasero, 06/01/2013
- Re: [cgal-discuss] Getting index of facet closest to a point, Sebastien Loriot (GeometryFactory), 06/03/2013
- [cgal-discuss] Re: Getting index of facet closest to a point, rcasero, 06/04/2013
- Re: [cgal-discuss] Re: Getting index of facet closest to a point, Philipp Moeller, 06/06/2013
- [cgal-discuss] Re: Getting index of facet closest to a point, rcasero, 06/04/2013
- Re: [cgal-discuss] Getting index of facet closest to a point, Sebastien Loriot (GeometryFactory), 06/03/2013
Archive powered by MHonArc 2.6.18.