mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Bugfix: some extra spots were added in medial axis
This commit is contained in:
		
							parent
							
								
									79d55efa0e
								
							
						
					
					
						commit
						70fb381ecf
					
				
					 1 changed files with 7 additions and 2 deletions
				
			
		|  | @ -154,15 +154,20 @@ ExPolygon::medial_axis(double max_width, double min_width, Polylines* polylines) | |||
|     // compute the Voronoi diagram
 | ||||
|     ma.build(polylines); | ||||
|      | ||||
|     // clip segments to our expolygon area
 | ||||
|     // (do this before extending endpoints as external segments coule be extended into
 | ||||
|     // expolygon, this leaving wrong things inside)
 | ||||
|     intersection(*polylines, *this, *polylines); | ||||
|      | ||||
|     // extend initial and final segments of each polyline (they will be clipped)
 | ||||
|     // unless they represent closed loops
 | ||||
|     for (Polylines::iterator polyline = polylines->begin(); polyline != polylines->end(); ++polyline) { | ||||
|         if (polyline->points.front().coincides_with(polyline->points.back())) continue; | ||||
|         if (polyline->points.front().distance_to(polyline->points.back()) < min_width) continue; | ||||
|         polyline->extend_start(max_width); | ||||
|         polyline->extend_end(max_width); | ||||
|     } | ||||
|      | ||||
|     // clip segments to our expolygon area
 | ||||
|     // clip again after extending endpoints to prevent them from exceeding the expolygon boundaries
 | ||||
|     intersection(*polylines, *this, *polylines); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci