mirror of https://github.com/CGAL/cgal
whitespace
This commit is contained in:
parent
295bc8cd5a
commit
1dca582e62
|
|
@ -11,6 +11,75 @@ typedef CGAL::Bounded_kernel<Kernel> Bounded_kernel;
|
|||
typedef CGAL::Nef_polyhedron_2<Bounded_kernel> Nef_polyhedron;
|
||||
typedef Nef_polyhedron::Point Point;
|
||||
|
||||
typedef Nef_polyhedron::Explorer Explorer;
|
||||
typedef Explorer::Face_const_iterator Face_const_iterator;
|
||||
typedef Explorer::Hole_const_iterator Hole_const_iterator;
|
||||
typedef Explorer::Halfedge_around_face_const_circulator Halfedge_around_face_const_circulator;
|
||||
typedef Explorer::Vertex_const_handle Vertex_const_handle;
|
||||
typedef Explorer::Isolated_vertex_const_iterator Isolated_vertex_const_iterator;
|
||||
|
||||
void print(Explorer& explorer, Vertex_const_handle vh, bool exact)
|
||||
{
|
||||
std::cout << explorer.point(vh);
|
||||
if (exact)
|
||||
std::cout << " [" << explorer.point(vh).x().exact() << " | " << explorer.point(vh).y().exact() << "]";
|
||||
std::cout << ", ";
|
||||
}
|
||||
|
||||
void print(const Nef_polyhedron& poly, bool exact = false)
|
||||
{
|
||||
|
||||
|
||||
Explorer explorer = poly.explorer();
|
||||
|
||||
// The first face is the infinite one. It has no outer face cycle but only holes
|
||||
Face_const_iterator fit = explorer.faces_begin();
|
||||
std::cout << "explorer.mark(explorer.faces_begin()) " << ((explorer.mark(fit)) ? "is part of polygon" : "is not part of polygon") << std::endl;
|
||||
for (Hole_const_iterator hit = explorer.holes_begin(fit); hit != explorer.holes_end(fit); hit++) {
|
||||
std::cout << " A hole" << std::endl;
|
||||
Halfedge_around_face_const_circulator hafc(hit), done(hit);
|
||||
do {
|
||||
Vertex_const_handle vh = explorer.target(hafc);
|
||||
print(explorer, vh, exact);
|
||||
hafc++;
|
||||
} while (hafc != done);
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
for (Isolated_vertex_const_iterator it = explorer.isolated_vertices_begin(fit); it != explorer.isolated_vertices_end(fit); ++it) {
|
||||
std::cout << "isolated vertex A" << explorer.point(it) << std::endl;
|
||||
}
|
||||
|
||||
// The other faces have outer face cycles, and they may have holes
|
||||
for (fit++;
|
||||
fit != explorer.faces_end();
|
||||
fit++) {
|
||||
for (Isolated_vertex_const_iterator it = explorer.isolated_vertices_begin(fit); it != explorer.isolated_vertices_end(fit); ++it) {
|
||||
std::cout << "isolated vertex B" << std::endl;
|
||||
}
|
||||
Halfedge_around_face_const_circulator hafc = explorer.face_cycle(fit), done(hafc);
|
||||
std::cout << "face: " << ((explorer.mark(fit)) ? "is part of polygon" : "is not part of polygon") << std::endl;
|
||||
do {
|
||||
Vertex_const_handle vh = explorer.target(hafc);
|
||||
print(explorer, vh, exact);
|
||||
hafc++;
|
||||
} while (hafc != done);
|
||||
std::cout << std::endl;
|
||||
for (Hole_const_iterator hit = explorer.holes_begin(fit); hit != explorer.holes_end(fit); hit++) {
|
||||
std::cout << " A hole" << std::endl;
|
||||
Halfedge_around_face_const_circulator hafc(hit), done(hit);
|
||||
do {
|
||||
Vertex_const_handle vh = explorer.target(hafc);
|
||||
print(explorer, vh, exact);
|
||||
hafc++;
|
||||
} while (hafc != done);
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
|
@ -39,6 +108,8 @@ int main(int argc, char *argv[])
|
|||
Nef_polyhedron intersect = poly1.intersection(poly2);
|
||||
intersect.explorer().check_integrity_and_topological_planarity();
|
||||
|
||||
print(intersect);
|
||||
|
||||
Nef_polyhedron comp = intersect.complement(); //leads to crash/exception since topological plane map of intersect is not correct!
|
||||
comp.explorer().check_integrity_and_topological_planarity();
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue