diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgaladv.cc | 25 | ||||
-rw-r--r-- | src/cgaladv_convexhull2.cc | 18 |
2 files changed, 21 insertions, 22 deletions
diff --git a/src/cgaladv.cc b/src/cgaladv.cc index 6301cd3..0dc70ad 100644 --- a/src/cgaladv.cc +++ b/src/cgaladv.cc @@ -183,25 +183,24 @@ CGAL_Nef_polyhedron CgaladvNode::render_cgal_nef_polyhedron() const if (type == HULL) { - - std::list<CGAL_Nef_polyhedron2> polys; - bool all2d = true; - foreach(AbstractNode * v, children) { - if (v->modinst->tag_background) + std::list<CGAL_Nef_polyhedron2> polys; + bool all2d = true; + foreach(AbstractNode * v, children) { + if (v->modinst->tag_background) continue; - N = v->render_cgal_nef_polyhedron(); - if (N.dim == 3) { + N = v->render_cgal_nef_polyhedron(); + if (N.dim == 3) { //polys.push_back(tmp.p3); all2d=false; - } - if (N.dim == 2) { + } + if (N.dim == 2) { polys.push_back(N.p2); + } + v->progress_report(); } - v->progress_report(); - } - if(all2d) - N.p2 = convexhull2(polys); + if (all2d) + N.p2 = convexhull2(polys); } cgal_nef_cache.insert(cache_id, new cgal_nef_cache_entry(N), N.weight()); diff --git a/src/cgaladv_convexhull2.cc b/src/cgaladv_convexhull2.cc index e1e466d..448dd4b 100644 --- a/src/cgaladv_convexhull2.cc +++ b/src/cgaladv_convexhull2.cc @@ -34,22 +34,22 @@ extern CGAL_Poly2 nef2p2(CGAL_Nef_polyhedron2 p); CGAL_Nef_polyhedron2 convexhull2(std::list<CGAL_Nef_polyhedron2> a) { - std::list<CGAL_Nef_polyhedron2::Point> points; + std::list<CGAL_Nef_polyhedron2::Point> points; - std::list<CGAL_Nef_polyhedron2>::iterator i; - for(i=a.begin(); i!=a.end(); i++) { - CGAL_Poly2 ap=nef2p2(*i); - for (int j=0;j<ap.size();j++) { + std::list<CGAL_Nef_polyhedron2>::iterator i; + for (i=a.begin(); i!=a.end(); i++) { + CGAL_Poly2 ap=nef2p2(*i); + for (size_t j=0;j<ap.size();j++) { double x=to_double(ap[j].x()),y=to_double(ap[j].y()); CGAL_Nef_polyhedron2::Point p=CGAL_Nef_polyhedron2::Point(x,y); points.push_back(p); + } } - } - std::list<CGAL_Nef_polyhedron2::Point> result; - CGAL::convex_hull_2(points.begin(),points.end(),std::back_inserter(result)); + std::list<CGAL_Nef_polyhedron2::Point> result; + CGAL::convex_hull_2(points.begin(),points.end(),std::back_inserter(result)); - return CGAL_Nef_polyhedron2(result.begin(),result.end(),CGAL_Nef_polyhedron2::INCLUDED); + return CGAL_Nef_polyhedron2(result.begin(),result.end(),CGAL_Nef_polyhedron2::INCLUDED); } #endif |