Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Triangulation problem

Subject: CGAL users discussion list

List archive

[cgal-discuss] Triangulation problem


Chronological Thread 
  • From: <>
  • To:
  • Subject: [cgal-discuss] Triangulation problem
  • Date: Thu, 16 Jul 2009 19:19:30 +0200 (CEST)

Hello, Im trying to use CGAL to triangulate polygon and I run into problem
with
triangle orientation. CGAL always generate counter clock wise triangles for
some polygons. Here is my code:

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;


typedef CGAL::Triangulation_3<K> Triangulation;

typedef Triangulation::Cell_handle Cell_handle;
typedef Triangulation::Vertex_handle Vertex_handle;
typedef Triangulation::Locate_type Locate_type;
typedef Triangulation::Point Point;
typedef Triangulation::Facet_iterator Facet_iterator;
typedef Triangulation::Facet Facet;

// construction from a list of points :

std::list<Point> L;

L.push_back(Point(0, 0, 0));
Lpush_back(Point(25, 0, 0));
Lpush_back(Point(25, 0, 25));
Lpush_back(Point(0,0, 25));


Triangulation T(L.begin(), L.end());

for (Triangulation::Finite_facets_iterator fit = T.finite_facets_begin();
fit != T.finite_facets_end(); ++fit)
{
K::Triangle_3 triangle = T.triangle(*fit);
Point vertex = triangle.vertex(0);
triangles.push_back(Vec3(vertex.x(), vertex.y(), vertex.z()));

vertex = triangle.vertex(1);
triangles.push_back(Vec3(vertex.x(), vertex.y(), vertex.z()));

vertex = triangle.vertex(2);
triangles.push_back(Vec3(vertex.x(), vertex.y(), vertex.z()));
}

can I somehow set Triangluation to give me clockwise triangles? thx for help



Archive powered by MHonArc 2.6.16.

Top of Page