void PolyTreeToExPolygons(ClipperLib::PolyTree& polytree, Slic3r::ExPolygons* expolygons) { PROFILE_FUNC(); expolygons->clear(); for (int i = 0; i < polytree.ChildCount(); ++i) AddOuterPolyNodeToExPolygons(*polytree.Childs[i], expolygons); }
ExPolygons PolyTreeToExPolygons(ClipperLib::PolyTree& polytree) { ExPolygons retval; for (int i = 0; i < polytree.ChildCount(); ++i) AddOuterPolyNodeToExPolygons(*polytree.Childs[i], &retval); return retval; }
//----------------------------------------------------------- // legacy code from Clipper documentation void AddOuterPolyNodeToExPolygons(ClipperLib::PolyNode& polynode, Slic3r::ExPolygons& expolygons) { size_t cnt = expolygons.size(); expolygons.resize(cnt + 1); ClipperPath_to_Slic3rMultiPoint(polynode.Contour, expolygons[cnt].contour); expolygons[cnt].holes.resize(polynode.ChildCount()); for (int i = 0; i < polynode.ChildCount(); ++i) { ClipperPath_to_Slic3rMultiPoint(polynode.Childs[i]->Contour, expolygons[cnt].holes[i]); //Add outer polygons contained by (nested within) holes ... for (int j = 0; j < polynode.Childs[i]->ChildCount(); ++j) AddOuterPolyNodeToExPolygons(*polynode.Childs[i]->Childs[j], expolygons); } }
//----------------------------------------------------------- // legacy code from Clipper documentation void AddOuterPolyNodeToExPolygons(ClipperLib::PolyNode& polynode, ExPolygons* expolygons) { size_t cnt = expolygons->size(); expolygons->resize(cnt + 1); (*expolygons)[cnt].contour = ClipperPath_to_Slic3rPolygon(polynode.Contour); (*expolygons)[cnt].holes.resize(polynode.ChildCount()); for (int i = 0; i < polynode.ChildCount(); ++i) { (*expolygons)[cnt].holes[i] = ClipperPath_to_Slic3rPolygon(polynode.Childs[i]->Contour); //Add outer polygons contained by (nested within) holes ... for (int j = 0; j < polynode.Childs[i]->ChildCount(); ++j) AddOuterPolyNodeToExPolygons(*polynode.Childs[i]->Childs[j], expolygons); } }
void Clipping::AddOuterPolyNodeToExPolygons(const CL::PolyNode * polynode, ExPolygons& expolygons) { size_t cnt = expolygons.size(); expolygons.resize(cnt + 1); expolygons[cnt].outer = polynode->Contour; expolygons[cnt].holes.resize(polynode->ChildCount()); for (int i = 0; i < polynode->ChildCount(); ++i) { expolygons[cnt].holes[i] = polynode->Childs[i]->Contour; //Add outer polygons contained by (nested within) holes ... for (int j = 0; j < polynode->Childs[i]->ChildCount(); ++j) AddOuterPolyNodeToExPolygons(polynode->Childs[i]->Childs[j], expolygons); } }
void PolyTreeToExPolygons(ClipperLib::PolyTree& polytree, Slic3r::ExPolygons& expolygons) { expolygons.clear(); for (int i = 0; i < polytree.ChildCount(); ++i) AddOuterPolyNodeToExPolygons(*polytree.Childs[i], expolygons); }
void Clipping::PolyTreeToExPolygons(const CL::PolyTree * polytree, ExPolygons& expolygons) { expolygons.clear(); for (int i = 0; i < polytree->ChildCount(); ++i) AddOuterPolyNodeToExPolygons(polytree->Childs[i], expolygons); }