mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Clipper optimization:
1) Removed the already commented-out scaling / unscaling when doing "safe offsetting" 2) Removed some of the "safe offsetting" at calls where it never was used. 3) Reworked Clipper & ClipperUtils to pass Polygons / ExPolygons / Surfaces as input parameters without conversion to ClipperLib::Paths. This should save a lot of memory allocation and copying. 4) Reworked conversions from ClipperLib::Paths & PolyTree to Polygons / ExPolygons to use the move operator to avoid many unnecessary allocations. 5) Reworked some "union with safe ofsetting" to "offset_ex", which should be cheaper.
This commit is contained in:
		
							parent
							
								
									b327314b02
								
							
						
					
					
						commit
						9fbba855ef
					
				
					 15 changed files with 616 additions and 722 deletions
				
			
		|  | @ -179,10 +179,10 @@ PadSkeleton divide_blueprint(const ExPolygons &bp) | |||
|     ret.outer.reserve(size_t(ptree.Total())); | ||||
| 
 | ||||
|     for (ClipperLib::PolyTree::PolyNode *node : ptree.Childs) { | ||||
|         ExPolygon poly(ClipperPath_to_Slic3rPolygon(node->Contour)); | ||||
|         ExPolygon poly; | ||||
|         poly.contour.points = std::move(node->Contour); | ||||
|         for (ClipperLib::PolyTree::PolyNode *child : node->Childs) { | ||||
|             poly.holes.emplace_back( | ||||
|                 ClipperPath_to_Slic3rPolygon(child->Contour)); | ||||
|             poly.holes.emplace_back(std::move(child->Contour)); | ||||
| 
 | ||||
|             traverse_pt(child->Childs, &ret.inner); | ||||
|         } | ||||
|  | @ -342,18 +342,18 @@ public: | |||
| template<class...Args> | ||||
| ExPolygon offset_contour_only(const ExPolygon &poly, coord_t delta, Args...args) | ||||
| { | ||||
|     ExPolygons tmp = offset_ex(poly.contour, float(delta), args...); | ||||
|     Polygons tmp = offset(poly.contour, float(delta), args...); | ||||
| 
 | ||||
|     if (tmp.empty()) return {}; | ||||
| 
 | ||||
|     Polygons holes = poly.holes; | ||||
|     for (auto &h : holes) h.reverse(); | ||||
| 
 | ||||
|     tmp = diff_ex(to_polygons(tmp), holes); | ||||
|     ExPolygons tmp2 = diff_ex(tmp, holes); | ||||
| 
 | ||||
|     if (tmp.empty()) return {}; | ||||
|     if (tmp2.empty()) return {}; | ||||
| 
 | ||||
|     return tmp.front(); | ||||
|     return std::move(tmp2.front()); | ||||
| } | ||||
| 
 | ||||
| bool add_cavity(Contour3D &pad, ExPolygon &top_poly, const PadConfig3D &cfg, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vojtech Bubnik
						Vojtech Bubnik