Readability changes

This commit is contained in:
Mael Rouxel-Labbé 2018-04-26 13:58:23 +02:00
parent 9faf52a7f5
commit c5f134c9ae
8 changed files with 34 additions and 41 deletions

View File

@ -51,16 +51,16 @@ public:
: Fb() {} : Fb() {}
Triangulation_face_base_2(Vertex_handle v0, Triangulation_face_base_2(Vertex_handle v0,
Vertex_handle v1, Vertex_handle v1,
Vertex_handle v2) Vertex_handle v2)
: Fb(v0,v1,v2) {} : Fb(v0,v1,v2) {}
Triangulation_face_base_2(Vertex_handle v0, Triangulation_face_base_2(Vertex_handle v0,
Vertex_handle v1, Vertex_handle v1,
Vertex_handle v2, Vertex_handle v2,
Face_handle n0, Face_handle n0,
Face_handle n1, Face_handle n1,
Face_handle n2) Face_handle n2)
: Fb(v0,v1,v2,n0,n1,n2) {} : Fb(v0,v1,v2,n0,n1,n2) {}
static int ccw(int i) {return Triangulation_cw_ccw_2::ccw(i);} static int ccw(int i) {return Triangulation_cw_ccw_2::ccw(i);}

View File

@ -20,12 +20,8 @@ public:
}; };
My_vertex_base() {} My_vertex_base() {}
My_vertex_base(const Point& p) : Vb(p) {}
My_vertex_base(const Point& p) My_vertex_base(const Point& p, Cell_handle c) : Vb(p, c) {}
: Vb(p) {}
My_vertex_base(const Point& p, Cell_handle c)
: Vb(p, c) {}
Vertex_handle vh; Vertex_handle vh;
Cell_handle ch; Cell_handle ch;

View File

@ -17,19 +17,18 @@ int main()
for (int z=0 ; z<20 ; z++) for (int z=0 ; z<20 ; z++)
for (int y=0 ; y<20 ; y++) for (int y=0 ; y<20 ; y++)
for (int x=0 ; x<20 ; x++) for (int x=0 ; x<20 ; x++)
P.push_back(Point(x,y,z)); P.push_back(Point(x,y,z));
// building their Delaunay triangulation. // building their Delaunay triangulation.
Delaunay T(P.begin(), P.end()); Delaunay T(P.begin(), P.end());
assert( T.number_of_vertices() == 8000 ); assert( T.number_of_vertices() == 8000 );
// performing nearest vertex queries to a series of random points, // performing nearest vertex queries to a series of random points,
// which is a case where the Fast_location policy is beneficial. // which is a case where the Fast_location policy is beneficial.
for (int i=0; i<10000; ++i) for (int i=0; i<10000; ++i)
T.nearest_vertex(Point(CGAL::get_default_random().get_double(0, 20), T.nearest_vertex(Point(CGAL::get_default_random().get_double(0, 20),
CGAL::get_default_random().get_double(0, 20), CGAL::get_default_random().get_double(0, 20),
CGAL::get_default_random().get_double(0, 20))); CGAL::get_default_random().get_double(0, 20)));
return 0; return 0;
} }

View File

@ -35,7 +35,6 @@ int main()
points.push_back(Point(2,2,2)); points.push_back(Point(2,2,2));
points.push_back(Point(-1,0,1)); points.push_back(Point(-1,0,1));
Delaunay T( boost::make_transform_iterator(points.begin(),Auto_count()), Delaunay T( boost::make_transform_iterator(points.begin(),Auto_count()),
boost::make_transform_iterator(points.end(), Auto_count() ) ); boost::make_transform_iterator(points.end(), Auto_count() ) );

View File

@ -18,7 +18,6 @@ typedef Delaunay::Point Point;
int main() int main()
{ {
std::vector<unsigned> indices; std::vector<unsigned> indices;
indices.push_back(0); indices.push_back(0);
indices.push_back(1); indices.push_back(1);
@ -35,14 +34,11 @@ int main()
points.push_back(Point(2,2,2)); points.push_back(Point(2,2,2));
points.push_back(Point(-1,0,1)); points.push_back(Point(-1,0,1));
Delaunay T( boost::make_zip_iterator(boost::make_tuple( points.begin(),indices.begin() )), Delaunay T( boost::make_zip_iterator(boost::make_tuple( points.begin(),indices.begin() )),
boost::make_zip_iterator(boost::make_tuple( points.end(),indices.end() ) ) ); boost::make_zip_iterator(boost::make_tuple( points.end(),indices.end() ) ) );
CGAL_assertion( T.number_of_vertices() == 6 ); CGAL_assertion( T.number_of_vertices() == 6 );
// check that the info was correctly set. // check that the info was correctly set.
Delaunay::Finite_vertices_iterator vit; Delaunay::Finite_vertices_iterator vit;
for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit)

View File

@ -36,9 +36,9 @@ int main()
// Construct the locking data-structure, using the bounding-box of the points // Construct the locking data-structure, using the bounding-box of the points
Triangulation::Lock_data_structure locking_ds( Triangulation::Lock_data_structure locking_ds(
CGAL::Bbox_3(-1., -1., -1., 1., 1., 1.), 50); CGAL::Bbox_3(-1., -1., -1., 1., 1., 1.), 50);
// Construct the triangulation in parallel // Construct the triangulation in parallel
Triangulation T(V.begin(), V.end(), &locking_ds); Triangulation T(V.begin(), V.end(), &locking_ds);
assert(T.is_valid()); assert(T.is_valid());
#endif //CGAL_LINKED_WITH_TBB #endif //CGAL_LINKED_WITH_TBB

View File

@ -1,5 +1,7 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Regular_triangulation_3.h> #include <CGAL/Regular_triangulation_3.h>
#include <cassert> #include <cassert>
#include <vector> #include <vector>
@ -24,10 +26,10 @@ int main()
for (int z=0 ; z<5 ; z++) for (int z=0 ; z<5 ; z++)
for (int y=0 ; y<5 ; y++) for (int y=0 ; y<5 ; y++)
for (int x=0 ; x<5 ; x++) { for (int x=0 ; x<5 ; x++) {
Point p(x, y, z); Point p(x, y, z);
Weight w = (x+y-z*y*x)*2.0; // let's say this is the weight. Weight w = (x+y-z*y*x)*2.0; // let's say this is the weight.
P.push_back(Weighted_point(p, w)); P.push_back(Weighted_point(p, w));
++number_of_points; ++number_of_points;
} }
Rt T; Rt T;
@ -43,8 +45,8 @@ int main()
// removal of all vertices // removal of all vertices
int count = 0; int count = 0;
while (T.number_of_vertices() > 0) { while (T.number_of_vertices() > 0) {
T.remove (T.finite_vertices_begin()); T.remove (T.finite_vertices_begin());
++count; ++count;
} }
assert( count == number_of_points ); assert( count == number_of_points );

View File

@ -1,4 +1,5 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Triangulation_3.h> #include <CGAL/Triangulation_3.h>
#include <iostream> #include <iostream>