Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Delaunay triangulation 2D
- Date: Tue, 27 Jul 2010 08:32:31 +0200
Hello,
the example you need to look at is the following:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Mesh_2/Chapter_main.html#Subsection_45.2.7
You need to seed each hole of your polygon.
If you need to have an index to each vertex, you need to use a vertex_with_info:
Instead of :
typedef CGAL::Triangulation_vertex_base_2<K> Vb;
use:
typedef CGAL::Triangulation_vertex_base_2<K> Vbase;
typedef CGAL::Triangulation_vertex_base_with_info_2<int,K,Vbase> Vb;
as describe here:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_2_ref/Class_Triangulation_vertex_base_with_info_2.html#Cross_link_anchor_1300
Then when you insert a point use the info() method to set and get the index of your point.
ex:
Vertex_handle va = cdt.insert(Point(2,0));
va->info()=1;
Have a look here for the infinite and finite facet definition:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_2/Chapter_main.html#Section_35.2
S.
Aurélien .... wrote:
Hello everyone,
I'm totally lost and I need some help.
I have outer points which define an outer polygon. Then, I have inner point which define holes.
I need to triangulation this 2D form.
I tried a delaunay triangulation like this :
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Delaunay_mesher_2.h>
#include <CGAL/Delaunay_mesh_face_base_2.h>
#include <CGAL/Delaunay_mesh_size_criteria_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> CDT;
typedef CGAL::Delaunay_mesh_size_criteria_2<CDT> Criteria;
typedef CGAL::Delaunay_mesher_2<CDT, Criteria> Mesher;
typedef CDT::Vertex_handle Vertex_handle;
typedef CDT::Point Point;
typedef CDT::Face_iterator Face_iterator;
CDT cdt;
// Insert point by point with cdt.insert
Mesher mesher(cdt); mesher.refine_mesh();
for(Face_iterator oFaceIt = cdt.faces_begin(); oFaceIt != cdt.faces_end(); ++oFaceIt)
{
// Add vertex 0, 1, 2 to the vertex array
// Add 0, 1, 2 to the face indices array
}
The graphic result is not correct.
First of all, I have 212 faces for 145 vertices. Is there is a possibility to have the index of the vertices instead their coords ? In order to enter to the graphic engine 145 vertices and not 212 * 3 ?
After, what's the diferences between faces, finite_faces and all_faces ?
Is their an xample to show these problematics solved together ?
Thank you very much,
Aurélien
- [cgal-discuss] Delaunay triangulation 2D, Aurélien . . . ., 07/26/2010
- Re: [cgal-discuss] Delaunay triangulation 2D, Sebastien Loriot (GeometryFactory), 07/27/2010
- Re: [cgal-discuss] Delaunay triangulation 2D, Aurélien . . . ., 07/27/2010
- Re: [cgal-discuss] Delaunay triangulation 2D, Sebastien Loriot (GeometryFactory), 07/27/2010
- Re: [cgal-discuss] Delaunay triangulation 2D, Aurélien . . . ., 07/27/2010
- Re: [cgal-discuss] Delaunay triangulation 2D, Sebastien Loriot (GeometryFactory), 07/27/2010
Archive powered by MHonArc 2.6.16.