Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Delaunay 3D: Get triangle with info in vertices.

Subject: CGAL users discussion list

List archive

[cgal-discuss] Delaunay 3D: Get triangle with info in vertices.


Chronological Thread 
  • From: Michael Kalygin <>
  • To:
  • Subject: [cgal-discuss] Delaunay 3D: Get triangle with info in vertices.
  • Date: Sat, 4 May 2013 05:10:50 -0700 (PDT)

Hello everyone! I was trying to find a solution on the forum. But it seems that the problem is quite specific. Let me describe it. First of all I'm using the next data structures:

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_with_info_3<double, K> Vb;
typedef CGAL::Triangulation_data_structure_3 Tds;
typedef CGAL::Delaunay_triangulation_3<K, Tds> Delaunay;
typedef K::Segment_3 Segment;
typedef K::Point_3 Point;
Note, that I'm using vertices with info, I need info() field to store my custom data about vertices.

The Method: I have a method in my class, which finds a triangle of Delaunay triangulation intersecting with segment [p, 0), where p and 0 are vectors in 3D space (p is an input parameter). The intersection exists with guarantee and this intersection is a point. When the method finds an intersection, it returns founded triangle. As a side effect it assigns point of intersection to p.

The Problem: When I get triangle in the method, I actually lose info() in its vertices. I need to get this info without any additional operations. Previously, I was using nearest_vertex() method of a triangulation, but it looks like a needless operation which slows down my algorithm.

tr.vertex(0).info(); // This field doesn't exist.
The question: Is there a way to get a triangle with info() in its vertices?

Additional question: Is there a simple way to mark a cell, from which I need to start a search of such triangle?

The Code:

Delaunay::Triangle ADMath::ProjectAndLocatePoint(Point &p)
{
    const double EPS = 0.01;
    Delaunay::Triangle tr;
    Segment seg = Segment(p, Point(p.x() * EPS, p.y() * EPS, p.z() * EPS)); // Segment with excluded (0, 0, 0).
    CGAL::Object intersection;

    for (Delaunay::Finite_facets_iterator fit = ADMath::triangulation->finite_facets_begin(); fit != ADMath::triangulation->finite_facets_end(); ++fit) {
        tr = ADMath::triangulation->triangle(*fit); // THE PROBLEM IS HERE

        if (CGAL::do_intersect(seg, tr)) {
            intersection = CGAL::intersection(seg, tr);
            p = *CGAL::object_cast(&intersection); // Set p to its projection on the triangle.
            break;
        }
    }

    return tr;
}


View this message in context: Delaunay 3D: Get triangle with info in vertices.
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page