CGAL 6.1 - 2D Triangulations

Loading...
Searching...
No Matches
Triangulation_2/constrained_hierarchy_plus.cpp
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_hierarchy_2.h>
#include <CGAL/Constrained_triangulation_plus_2.h>
#include <cassert>
#include <iostream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_2<K> Vbb;
typedef CGAL::Triangulation_hierarchy_vertex_base_2<Vbb> Vb;
typedef CGAL::Constrained_triangulation_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
typedef CGAL::Exact_predicates_tag Itag;
typedef CGAL::Constrained_Delaunay_triangulation_2<K,TDS,Itag> CDT;
typedef CGAL::Triangulation_hierarchy_2<CDT> CDTH;
typedef CGAL::Constrained_triangulation_plus_2<CDTH> Triangulation;
typedef Triangulation::Vertex_handle Vertex_handle;
typedef Triangulation::Point Point;
int
main( )
{
Triangulation cdt;
std::cout << "Inserting a grid 5 x 5 of 10 intersecting constraints " << std::endl;
for (int i = 1; i < 6; ++i)
cdt.insert_constraint( Point(0,i), Point(6,i));
for (int j = 1; j < 6; ++j)
cdt.insert_constraint( Point(j,0), Point(j,6));
int count = 0;
using Sc = Triangulation::Subconstraint;
for (const Sc& sc : cdt.subconstraints()) {
std::cout << sc.first->point() << " - " << sc.second->point() << std::endl;
++count;
}
std::cout << "The number of resulting constrained edges is ";
std::cout << count << std::endl;
//verbose mode of is_valid ; shows the number of vertices at each level
std::cout << "The number of vertices at successive levels" << std::endl;
bool valid = cdt.is_valid(true);
return valid ? 0 : 1;
}
CGAL::Constrained_Delaunay_triangulation_2
A constrained Delaunay triangulation is a triangulation with constrained edges which tries to be as m...
Definition: Constrained_Delaunay_triangulation_2.h:96
CGAL::Constrained_triangulation_face_base_2
The class Constrained_triangulation_face_base_2 is the default model for the concept ConstrainedTrian...
Definition: Constrained_triangulation_face_base_2.h:34
CGAL::Constrained_triangulation_plus_2
The class Constrained_triangulation_plus_2<Tr> provides a constrained triangulation with an additiona...
Definition: Constrained_triangulation_plus_2.h:55
CGAL::Constrained_triangulation_plus_2::insert_constraint
Constraint_id insert_constraint(Point a, Point b)
inserts the constraint segment ab in the triangulation.
CGAL::Exact_predicates_inexact_constructions_kernel
CGAL::Triangulation_data_structure_2
CGAL::Triangulation_hierarchy_2
The class Triangulation_hierarchy_2 implements a triangulation augmented with a data structure which ...
Definition: Triangulation_hierarchy_2.h:62
CGAL::Triangulation_hierarchy_vertex_base_2
The class Triangulation_hierarchy_vertex_base_2 is designed to be used as a vertex base class of a tr...
Definition: Triangulation_hierarchy_2.h:100
CGAL::Triangulation_vertex_base_2
The class Triangulation_vertex_base_2 is the default model for the concept TriangulationVertexBase_2.
Definition: Triangulation_vertex_base_2.h:34
CGAL::Exact_predicates_tag
Intersection tag for constrained triangulations, if the geometric traits provides exact predicates bu...
Definition: Constrained_triangulation_2.h:51