Regular_triangulations are built using weighted points

This commit is contained in:
Mael Rouxel-Labbé 2017-05-10 12:34:54 +02:00
parent 70e1ac97f6
commit 60c161ace1
2 changed files with 13 additions and 5 deletions

View File

@ -0,0 +1,5 @@
0 0 0
1 0 1
0.2 0.2 2
0 1 -1
0 2 0.2

View File

@ -7,7 +7,7 @@
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_2 Point;
typedef K::Weighted_point_2 Weighted_point;
typedef CGAL::Regular_triangulation_2<K> Triangulation;
@ -51,17 +51,20 @@ VertexIdPropertyMap vertex_index_pmap(vertex_id_map);
int
main(int argc,char* argv[])
{
const char* filename = (argc > 1) ? argv[1] : "data/points.xy";
const char* filename = (argc > 1) ? argv[1] : "data/weighted_points.xyw";
std::ifstream input(filename);
Triangulation t;
Filter is_finite(t);
Finite_triangulation ft(t, is_finite, is_finite);
Point p ;
while(input >> p){
t.insert(p);
Weighted_point wp ;
while(input >> wp){
t.insert(wp);
}
// Note that with the input "data/weighted_points.xyw", there is one hidden vertex
std::cout << "number of hidden vertices: " << t.number_of_hidden_vertices() << std::endl;
vertex_iterator vit, ve;
// Associate indices to the vertices
int index = 0;