title: CGAL: Find face/triangle a point belongs to?
body: <p>After reading about it I've come to this:</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;CGAL/Exact_predicates_inexact_constructions_kernel.h&gt;
  #include &lt;CGAL/Delaunay_triangulation_2.h&gt;
  
  typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
  typedef CGAL::Delaunay_triangulation_2&lt;K&gt;                   Delaunay;    
  typedef K::Point_2                                          Point;
  
  void load_points(std::vector&lt; Point &gt;&amp; points)
  {
    points.push_back(Point(1., 1.));
    points.push_back(Point(2., 1.));
    points.push_back(Point(2., 2.));
    points.push_back(Point(1., 2.));      
  }
  
  int main()
  {
    std::vector&lt; Point &gt; points;
    load_points(points);
    Delaunay dt;
    dt.insert(points.begin(), points.end());
    std::cout &lt;&lt; dt.number_of_vertices() &lt;&lt; std::endl;
  
    typedef std::vector&lt;Delaunay::Face_handle&gt; Faces;
    Faces faces;
    std::back_insert_iterator&lt;Faces&gt; result( faces );
    result = dt.get_conflicts ( Delaunay::Point(1.5, 1.5),
                                  std::back_inserter(faces) );
  
    return 0;
  }
  </code></pre>
  
  <p>That should find the faces whose circumcircle contains the point. After that, I'd have to take these triangles and use a method to test if the point is inside them I think (does CGAL do this? I know it's easy to implement though).</p>
  
  <p>Anyway, how can I get the triangles out of faces?</p>
  
  <p>Answer is</p>
  
  <pre><code>CGAL::Triangle_2&lt;K&gt; f = dt.triangle(faces[0]);
  std::cout &lt;&lt; dt.triangle(faces[0]) &lt;&lt; std::endl;
  std::cout &lt;&lt; dt.triangle(faces[1]) &lt;&lt; std::endl;
  </code></pre>
  
  <p>etc</p>
  
  <p>I don't know how to use the Triangle class well but it's a start at least.</p>
  
  <p>I was gonna make an actual answer but stackoverflow didn't allow me to so.</p>