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

@ -15,7 +15,7 @@
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0+
//
//
//
// Author(s) : Mariette Yvinec
@ -29,10 +29,10 @@
#include <CGAL/triangulation_assertions.h>
#include <CGAL/Triangulation_ds_face_base_2.h>
namespace CGAL {
namespace CGAL {
template < typename Gt, typename Fb = Triangulation_ds_face_base_2<> >
class Triangulation_face_base_2
class Triangulation_face_base_2
: public Fb
{
public:
@ -50,17 +50,17 @@ public:
Triangulation_face_base_2()
: Fb() {}
Triangulation_face_base_2(Vertex_handle v0,
Vertex_handle v1,
Vertex_handle v2)
Triangulation_face_base_2(Vertex_handle v0,
Vertex_handle v1,
Vertex_handle v2)
: Fb(v0,v1,v2) {}
Triangulation_face_base_2(Vertex_handle v0,
Vertex_handle v1,
Vertex_handle v2,
Face_handle n0,
Face_handle n1,
Face_handle n2)
Triangulation_face_base_2(Vertex_handle v0,
Vertex_handle v1,
Vertex_handle v2,
Face_handle n0,
Face_handle n1,
Face_handle n2)
: Fb(v0,v1,v2,n0,n1,n2) {}
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(const Point& p)
: Vb(p) {}
My_vertex_base(const Point& p, Cell_handle c)
: Vb(p, c) {}
My_vertex_base(const Point& p) : Vb(p) {}
My_vertex_base(const Point& p, Cell_handle c) : Vb(p, c) {}
Vertex_handle vh;
Cell_handle ch;

View File

@ -17,19 +17,18 @@ int main()
for (int z=0 ; z<20 ; z++)
for (int y=0 ; y<20 ; y++)
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.
Delaunay T(P.begin(), P.end());
assert( T.number_of_vertices() == 8000 );
// performing nearest vertex queries to a series of random points,
// which is a case where the Fast_location policy is beneficial.
for (int i=0; i<10000; ++i)
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;
}

View File

@ -35,12 +35,11 @@ int main()
points.push_back(Point(2,2,2));
points.push_back(Point(-1,0,1));
Delaunay T( boost::make_transform_iterator(points.begin(),Auto_count()),
boost::make_transform_iterator(points.end(), Auto_count() ) );
CGAL_assertion( T.number_of_vertices() == 6 );
// check that the info was correctly set.
Delaunay::Finite_vertices_iterator vit;
for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit)
@ -49,6 +48,6 @@ int main()
exit(EXIT_FAILURE);
}
std::cout << "OK" << std::endl;
return 0;
}

View File

@ -18,15 +18,14 @@ typedef Delaunay::Point Point;
int main()
{
std::vector<unsigned> indices;
indices.push_back(0);
indices.push_back(1);
indices.push_back(2);
indices.push_back(3);
indices.push_back(4);
indices.push_back(5);
indices.push_back(5);
std::vector<Point> points;
points.push_back(Point(0,0,0));
points.push_back(Point(1,0,0));
@ -35,21 +34,18 @@ int main()
points.push_back(Point(2,2,2));
points.push_back(Point(-1,0,1));
Delaunay T( boost::make_zip_iterator(boost::make_tuple( points.begin(),indices.begin() )),
boost::make_zip_iterator(boost::make_tuple( points.end(),indices.end() ) ) );
CGAL_assertion( T.number_of_vertices() == 6 );
// check that the info was correctly set.
Delaunay::Finite_vertices_iterator vit;
for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit)
if( points[ vit->info() ] != vit->point() ){
std::cerr << "Error different info" << std::endl;
exit(EXIT_FAILURE);
}
}
return 0;
}

View File

@ -32,13 +32,13 @@ int main()
V.reserve(NUM_INSERTED_POINTS);
for (int i = 0; i != NUM_INSERTED_POINTS; ++i)
V.push_back(*rnd++);
// Construct the locking data-structure, using the bounding-box of the points
Triangulation::Lock_data_structure locking_ds(
CGAL::Bbox_3(-1., -1., -1., 1., 1., 1.), 50);
// Construct the triangulation in parallel
Triangulation T(V.begin(), V.end(), &locking_ds);
assert(T.is_valid());
#endif //CGAL_LINKED_WITH_TBB

View File

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

View File

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