Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Getting index of facet closest to a point

Subject: CGAL users discussion list

List archive

[cgal-discuss] Getting index of facet closest to a point


Chronological Thread 
  • From: rcasero <>
  • To:
  • Subject: [cgal-discuss] Getting index of facet closest to a point
  • Date: Fri, 31 May 2013 17:02:19 -0700 (PDT)

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.



Archive powered by MHonArc 2.6.18.

Top of Page