Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] bad triangles in 2D Delaunay triangulation

Subject: CGAL users discussion list

List archive

[cgal-discuss] bad triangles in 2D Delaunay triangulation


Chronological Thread 
  • From: artem blonskii <>
  • To:
  • Subject: [cgal-discuss] bad triangles in 2D Delaunay triangulation
  • Date: Mon, 1 Dec 2014 05:49:18 -0800 (PST)

Hi everyone!
I'm trying to build a triangulation of 2D figure. But it fails for some
figures, because bad triangles are produced. These triangles are built by
points which lie at the one line. I identify these triangles by the area.

Does anybody know how to fix it?

my code:
#include <iostream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_conformer_2.h>
#include <CGAL/Delaunay_mesher_2.h>
#include <CGAL/Delaunay_mesh_face_base_2.h>
#include <CGAL/Delaunay_mesh_size_criteria_2.h>
#include <CGAL/Constrained_triangulation_plus_2.h>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_2<K> Vb;
typedef CGAL::Delaunay_mesh_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds;
typedef CGAL::Constrained_Delaunay_triangulation_2<K, Tds,
CGAL::Exact_predicates_tag> CDT;

typedef CGAL::Delaunay_mesh_size_criteria_2<CDT> Criteria;
typedef CGAL::Delaunay_mesher_2<CDT, Criteria> Mesher2;
typedef CDT::Vertex_handle Vertex_handle;
typedef CDT::Point Point;

void some_function()
{
CDT_plus cdt;

Point hp[6];

hp[0] = Point(0.500000091410, 0.486455788882);
hp[1] = Point(-0.334032111870, 0.486455788837);
hp[2] = Point(-0.500000091424, 0.120965046601);
hp[3] = Point(-0.500000091430, 0.008971885303);
hp[4] = Point(0.482938375290, -0.486030074474);
hp[5] = Point(0.500000091434, -0.448457168454);


for (int i = 0; i < 6; ++i)
{
cdt.insert_constraint(hp[i], hp[i + 1 < 6 ? i + 1 : 0]);
}

Mesher mesher(cdt, Criteria(0.125, 0.3));
int i = 0;

mesher.refine_mesh();
for (CDT::Finite_faces_iterator it =
mesher.triangulation().finite_faces_begin(); it !=
mesher.triangulation().finite_faces_end(); it++)
{

CDT::Triangle trr = cdt.triangle(it);
if (trr.area()< 1e-12)
{
cout << "i am very saaad" << endl;
}
}
}






--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/bad-triangles-in-2D-Delaunay-triangulation-tp4660193.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page