diff options
author | Marius Kintel <marius@kintel.net> | 2011-04-10 15:41:54 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-04-10 15:41:54 (GMT) |
commit | 0c1b1f4e2243696cbec0427c41182c5529a6c55f (patch) | |
tree | e3eba37562b071db3c368e0425d220e8969bd701 /src | |
parent | 5739d33cd5c801d47b6d6e4b753811b13639bfbd (diff) |
Removed excessive debug output
Diffstat (limited to 'src')
-rw-r--r-- | src/cgaladv_minkowski2.cc | 59 |
1 files changed, 21 insertions, 38 deletions
diff --git a/src/cgaladv_minkowski2.cc b/src/cgaladv_minkowski2.cc index d03943c..fb8dd4b 100644 --- a/src/cgaladv_minkowski2.cc +++ b/src/cgaladv_minkowski2.cc @@ -31,8 +31,6 @@ #include "grid.h" #include "cgal.h" -#if 1 - #include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <CGAL/minkowski_sum_2.h> @@ -62,9 +60,9 @@ void print_polygon (const CGAL::Polygon_2<Kernel, Container>& P) template<class Kernel, class Container> void print_polygon_with_holes (const CGAL::Polygon_with_holes_2<Kernel, Container>& pwh) { if (! pwh.is_unbounded()) { - std::cout << "{ Outer boundary = "; - print_polygon (pwh.outer_boundary()); - } else + std::cout << "{ Outer boundary = "; + print_polygon (pwh.outer_boundary()); + } else std::cout << "{ Unbounded polygon." << std::endl; typename CGAL::Polygon_with_holes_2<Kernel,Container>::Hole_const_iterator hit; @@ -92,23 +90,20 @@ static Poly2 nef2p2(CGAL_Nef_polyhedron2 p) for (fci_t fit = E.faces_begin(), fend = E.faces_end(); fit != fend; ++fit) { - std::cout << "face " << ((E.mark(fit))? "is part of polygon" : "is not part of polygon") << std::endl; - if (!E.mark(fit)) { - continue; - } + if (!E.mark(fit)) { + continue; + } //if (fit != E.faces_begin()) { if (points.size() != 0) { PRINT("WARNING: minkowski() is not implemented for 2d objects with holes!"); - break; + break; } heafcc_t fcirc(E.halfedge(fit)), fend(fcirc); CGAL_For_all(fcirc, fend) { - //std::cout << "fcirc,fend " << std::endl; if (E.is_standard(E.target(fcirc))) { Explorer::Point ep = E.point(E.target(fcirc)); double x = to_double(ep.x()), y = to_double(ep.y()); - std::cout << "point " << ep << std::endl; grid.align(x, y); points.push_back(K2::Point_2(x, y)); } @@ -117,9 +112,10 @@ static Poly2 nef2p2(CGAL_Nef_polyhedron2 p) return Poly2(points.begin(), points.end()); } + static CGAL_Nef_polyhedron2 p2nef2(Poly2 p2) { std::list<CGAL_Nef_polyhedron2::Point> points; - for (int j = 0; j < p2.size(); j++) { + for (size_t j = 0; j < p2.size(); j++) { double x = to_double(p2[j].x()); double y = to_double(p2[j].y()); CGAL_Nef_polyhedron2::Point p = CGAL_Nef_polyhedron2::Point(x, y); @@ -131,33 +127,20 @@ static CGAL_Nef_polyhedron2 p2nef2(Poly2 p2) { CGAL_Nef_polyhedron2 minkowski2(CGAL_Nef_polyhedron2 a, CGAL_Nef_polyhedron2 b) { Poly2 ap = nef2p2(a), bp = nef2p2(b); - std::cout << "ap = "; print_polygon(ap); - std::cout << "bp = "; print_polygon(bp); - - if (ap.size() == 0) { - PRINT("WARNING: minkowski() could not get any points from object 1!"); - return CGAL_Nef_polyhedron2(); - } else if (bp.size() == 0) { - PRINT("WARNING: minkowski() could not get any points from object 2!"); - return CGAL_Nef_polyhedron2(); - } else { - Poly2h x = minkowski_sum_2(ap, bp); - std::cout << "result = "; print_polygon_with_holes(x); - - // Make a CGAL_Nef_polyhedron2 out of just the boundary for starters - return p2nef2(x.outer_boundary()); - } -} -#else - -CGAL_Nef_polyhedron2 minkowski2(CGAL_Nef_polyhedron2, CGAL_Nef_polyhedron2) -{ - PRINT("WARNING: minkowski() is not implemented yet for 2d objects!"); - return CGAL_Nef_polyhedron2(); + if (ap.size() == 0) { + PRINT("WARNING: minkowski() could not get any points from object 1!"); + return CGAL_Nef_polyhedron2(); + } else if (bp.size() == 0) { + PRINT("WARNING: minkowski() could not get any points from object 2!"); + return CGAL_Nef_polyhedron2(); + } else { + Poly2h x = minkowski_sum_2(ap, bp); + + // Make a CGAL_Nef_polyhedron2 out of just the boundary for starters + return p2nef2(x.outer_boundary()); + } } #endif -#endif - |