mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Fixed a bug that in edge cases, wrong top surfaces were detected (#4244)
offset clipped upper slices
This commit is contained in:
		
							parent
							
								
									8c941df4e8
								
							
						
					
					
						commit
						6f3a49aabe
					
				
					 1 changed files with 8 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -898,18 +898,16 @@ void PerimeterGenerator::split_top_surfaces(const ExPolygons &orig_polygons, ExP
 | 
			
		|||
    else
 | 
			
		||||
        offset_top_surface = 0;
 | 
			
		||||
    // don't takes into account too thin areas
 | 
			
		||||
    // skip if the exposed area is smaller than "min_width_top_surface"
 | 
			
		||||
    double min_width_top_surface = std::max(double(ext_perimeter_spacing / 2 + 10), scale_(config->min_width_top_surface.get_abs_value(unscale_(perimeter_width))));
 | 
			
		||||
 | 
			
		||||
    Polygons grown_upper_slices = offset(*this->upper_slices, min_width_top_surface);
 | 
			
		||||
 | 
			
		||||
    // get boungding box of last
 | 
			
		||||
    BoundingBox last_box = get_extents(orig_polygons);
 | 
			
		||||
    last_box.offset(SCALED_EPSILON);
 | 
			
		||||
 | 
			
		||||
    // skip if the exposed area is smaller than "min_width_top_surface"
 | 
			
		||||
    double min_width_top_surface = std::max(double(ext_perimeter_spacing / 2. + 10), scale_(config->min_width_top_surface.get_abs_value(unscale_(perimeter_width))));
 | 
			
		||||
 | 
			
		||||
    // get the Polygons upper the polygon this layer
 | 
			
		||||
    Polygons upper_polygons_series_clipped =
 | 
			
		||||
        ClipperUtils::clip_clipper_polygons_with_subject_bbox(grown_upper_slices, last_box);
 | 
			
		||||
    Polygons upper_polygons_series_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*this->upper_slices, last_box);
 | 
			
		||||
    upper_polygons_series_clipped          = offset(upper_polygons_series_clipped, min_width_top_surface);
 | 
			
		||||
 | 
			
		||||
    // set the clip to a virtual "second perimeter"
 | 
			
		||||
    fill_clip = offset_ex(orig_polygons, -double(ext_perimeter_spacing));
 | 
			
		||||
| 
						 | 
				
			
			@ -927,7 +925,7 @@ void PerimeterGenerator::split_top_surfaces(const ExPolygons &orig_polygons, ExP
 | 
			
		|||
        const float bridge_margin =
 | 
			
		||||
            std::min(float(scale_(BRIDGE_INFILL_MARGIN)), float(scale_(nozzle_diameter * BRIDGE_INFILL_MARGIN / 0.4)));
 | 
			
		||||
        bridge_checker = offset_ex(diff_ex(orig_polygons, lower_polygons_series_clipped, ApplySafetyOffset::Yes),
 | 
			
		||||
                                   1.5 * bridge_offset + bridge_margin + perimeter_spacing / 2);
 | 
			
		||||
                                   1.5 * bridge_offset + bridge_margin + perimeter_spacing / 2.);
 | 
			
		||||
    }
 | 
			
		||||
    ExPolygons delete_bridge = diff_ex(orig_polygons, bridge_checker, ApplySafetyOffset::Yes);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -937,7 +935,7 @@ void PerimeterGenerator::split_top_surfaces(const ExPolygons &orig_polygons, ExP
 | 
			
		|||
    ExPolygons temp_gap = diff_ex(top_polygons, fill_clip);
 | 
			
		||||
    ExPolygons inner_polygons =
 | 
			
		||||
        diff_ex(orig_polygons,
 | 
			
		||||
                offset_ex(top_polygons, offset_top_surface + min_width_top_surface - double(ext_perimeter_spacing / 2)),
 | 
			
		||||
                offset_ex(top_polygons, offset_top_surface + min_width_top_surface - double(ext_perimeter_spacing / 2.)),
 | 
			
		||||
                ApplySafetyOffset::Yes);
 | 
			
		||||
    // get the enlarged top surface, by using inner_polygons instead of upper_slices, and clip it for it to be exactly
 | 
			
		||||
    // the polygons to fill.
 | 
			
		||||
| 
						 | 
				
			
			@ -947,7 +945,7 @@ void PerimeterGenerator::split_top_surfaces(const ExPolygons &orig_polygons, ExP
 | 
			
		|||
    //set the clip to the external wall but go back inside by infill_extrusion_width/2 to be sure the extrusion won't go outside even with a 100% overlap.
 | 
			
		||||
    double infill_spacing_unscaled = this->config->sparse_infill_line_width.get_abs_value(nozzle_diameter);
 | 
			
		||||
    if (infill_spacing_unscaled == 0) infill_spacing_unscaled = Flow::auto_extrusion_width(frInfill, nozzle_diameter);
 | 
			
		||||
    fill_clip = offset_ex(orig_polygons, double(ext_perimeter_spacing / 2) - scale_(infill_spacing_unscaled / 2));
 | 
			
		||||
    fill_clip = offset_ex(orig_polygons, double(ext_perimeter_spacing / 2.) - scale_(infill_spacing_unscaled / 2.));
 | 
			
		||||
    // ExPolygons oldLast = last;
 | 
			
		||||
 | 
			
		||||
    non_top_polygons = intersection_ex(inner_polygons, orig_polygons);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue