mirror of https://github.com/CGAL/cgal
fix delaunay.cpp improperly counting infinite edges in dimension 1 because calling incident_faces in that case, instead of incident_full_cells
This commit is contained in:
parent
5fbec29fbe
commit
4cd3a9d860
|
|
@ -77,9 +77,6 @@ ________________________________________________________________TRIANGULATION
|
||||||
|
|
||||||
*) Why vertex at infinity should have index 0 in all cells it appears ?
|
*) Why vertex at infinity should have index 0 in all cells it appears ?
|
||||||
|
|
||||||
*) seems there is a bug in test triangulation.cpp for dimension 1: there is
|
|
||||||
zero vertices on the convex hull !! (should be 2)
|
|
||||||
|
|
||||||
_______________________________________________________DELAUNAY_TRIANGULATION
|
_______________________________________________________DELAUNAY_TRIANGULATION
|
||||||
|
|
||||||
________________________________________________________REGULAR_TRIANGULATION
|
________________________________________________________REGULAR_TRIANGULATION
|
||||||
|
|
|
||||||
|
|
@ -34,13 +34,13 @@ void test(const int d, const string & type, const int N)
|
||||||
typedef CGAL::Random_points_in_iso_box_d<Point> Random_points_iterator;
|
typedef CGAL::Random_points_in_iso_box_d<Point> Random_points_iterator;
|
||||||
|
|
||||||
DC pc(d);
|
DC pc(d);
|
||||||
cerr << "\nChecking Delaunay triangulation of (" << type << d << ") dimension with " << N << " points";
|
cerr << "\nBuilding Delaunay triangulation of (" << type << d << ") dimension with " << N << " points";
|
||||||
assert(pc.empty());
|
assert(pc.empty());
|
||||||
|
|
||||||
vector<Point> points;
|
vector<Point> points;
|
||||||
CGAL::Random rng;
|
CGAL::Random rng;
|
||||||
Random_points_iterator rand_it(d, 2.0, rng);
|
Random_points_iterator rand_it(d, 2.0, rng);
|
||||||
//CGAL::copy_n(rand_it, N, std::back_inserter(points));
|
//CGAL::copy_n(rand_it, N, back_inserter(points));
|
||||||
|
|
||||||
vector<int> coords(d);
|
vector<int> coords(d);
|
||||||
for( int i = 0; i < N; ++i )
|
for( int i = 0; i < N; ++i )
|
||||||
|
|
@ -60,27 +60,38 @@ void test(const int d, const string & type, const int N)
|
||||||
++fsit, ++nbfs;
|
++fsit, ++nbfs;
|
||||||
cerr << nbfs << " + ";
|
cerr << nbfs << " + ";
|
||||||
vector<Full_cell_handle> infinite_full_cells;
|
vector<Full_cell_handle> infinite_full_cells;
|
||||||
pc.incident_full_cells(pc.infinite_vertex(), std::back_inserter(infinite_full_cells));
|
pc.incident_full_cells(pc.infinite_vertex(), back_inserter(infinite_full_cells));
|
||||||
nbis = infinite_full_cells.size();
|
nbis = infinite_full_cells.size();
|
||||||
cerr << nbis << " = " << (nbis+nbfs)
|
cerr << nbis << " = " << (nbis+nbfs)
|
||||||
<< " = " << pc.number_of_full_cells();
|
<< " = " << pc.number_of_full_cells();
|
||||||
cerr << "\nComplex has current dimension " << pc.current_dimension();
|
cerr << "\nComplex has current dimension " << pc.current_dimension();
|
||||||
|
|
||||||
// Count convex hull vertices:
|
// Count convex hull vertices:
|
||||||
typedef std::vector<Face> Faces;
|
if( pc.ambient_dimension() > 1 )
|
||||||
Faces edges;
|
{
|
||||||
std::back_insert_iterator<Faces> out(edges);
|
typedef vector<Face> Faces;
|
||||||
pc.incident_upper_faces(pc.infinite_vertex(), 1, out);
|
Faces edges;
|
||||||
// Count the number of points on the convex hull
|
back_insert_iterator<Faces> out(edges);
|
||||||
std::cout << "\nThere are " << edges.size() << " vertices on the convex hull.";
|
pc.incident_faces(pc.infinite_vertex(), 1, out);
|
||||||
edges.clear();
|
cout << "\nThere are " << edges.size() << " vertices on the convex hull.";
|
||||||
|
edges.clear();
|
||||||
|
}
|
||||||
|
else // pc.ambient_dimension() == 1
|
||||||
|
{
|
||||||
|
typedef vector<Full_cell_handle> Cells;
|
||||||
|
Cells cells;
|
||||||
|
back_insert_iterator<Cells> out(cells);
|
||||||
|
pc.incident_full_cells(pc.infinite_vertex(), out);
|
||||||
|
cout << "\nThere are " << cells.size() << " vertices on the convex hull.";
|
||||||
|
cells.clear();
|
||||||
|
}
|
||||||
|
|
||||||
// Remove all !
|
// Remove all !
|
||||||
std::cerr << "\nBefore removal: " << pc.number_of_vertices() << " vertices. After: ";
|
cerr << "\nBefore removal: " << pc.number_of_vertices() << " vertices. After: ";
|
||||||
std::random_shuffle(points.begin(), points.end());
|
random_shuffle(points.begin(), points.end());
|
||||||
pc.remove(points.begin(), points.end());
|
pc.remove(points.begin(), points.end());
|
||||||
assert( pc.is_valid() );
|
assert( pc.is_valid() );
|
||||||
std::cerr << pc.number_of_vertices() << " vertices.";
|
cerr << pc.number_of_vertices() << " vertices.";
|
||||||
// assert( pc.empty() ); NOT YET !
|
// assert( pc.empty() ); NOT YET !
|
||||||
// CLEAR
|
// CLEAR
|
||||||
pc.clear();
|
pc.clear();
|
||||||
|
|
@ -114,6 +125,6 @@ int main(int argc, char **argv)
|
||||||
go<2>(N);
|
go<2>(N);
|
||||||
go<1>(N);
|
go<1>(N);
|
||||||
|
|
||||||
cerr << std::endl;
|
cerr << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue