mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 20:51:12 -06:00 
			
		
		
		
	Some incomplete work for cleaner infill logic
This commit is contained in:
		
							parent
							
								
									a9df56670f
								
							
						
					
					
						commit
						d928f005e6
					
				
					 2 changed files with 9 additions and 29 deletions
				
			
		|  | @ -52,7 +52,9 @@ sub make_fill { | |||
|      | ||||
|     Slic3r::debugf "Filling layer %d:\n", $layerm->id; | ||||
|      | ||||
|     # merge overlapping surfaces | ||||
|     # merge adjacent surfaces | ||||
|     # in case of bridge surfaces, the ones with defined angle will be attached to the ones | ||||
|     # without any angle (shouldn't this logic be moved to process_bridges()?) | ||||
|     my @surfaces = (); | ||||
|     { | ||||
|         my @surfaces_with_bridge_angle = grep defined $_->bridge_angle, @{$layerm->fill_surfaces}; | ||||
|  | @ -89,35 +91,10 @@ sub make_fill { | |||
|         } | ||||
|     } | ||||
|      | ||||
|     # add spacing between adjacent surfaces | ||||
|     # add spacing between surfaces | ||||
|     { | ||||
|         my $distance = $layerm->infill_flow->scaled_spacing / 2; | ||||
|         my @offsets = (); | ||||
|         foreach my $surface (@surfaces) { | ||||
|             my $expolygon = $surface->expolygon; | ||||
|             my $diff = diff_ex( | ||||
|                 [ $expolygon->offset($distance) ], | ||||
|                 $expolygon, | ||||
|                 1, | ||||
|             ); | ||||
|             push @offsets, map @$_, @$diff; | ||||
|         } | ||||
|          | ||||
|         my @new_surfaces = (); | ||||
|         foreach my $surface (@surfaces) { | ||||
|             my $diff = diff_ex( | ||||
|                 $surface->expolygon, | ||||
|                 [ @offsets ], | ||||
|             ); | ||||
|              | ||||
|             push @new_surfaces, map Slic3r::Surface->new( | ||||
|                 expolygon => $_, | ||||
|                 surface_type => $surface->surface_type, | ||||
|                 bridge_angle => $surface->bridge_angle, | ||||
|                 depth_layers => $surface->depth_layers, | ||||
|             ), @$diff; | ||||
|         } | ||||
|         @surfaces = @new_surfaces; | ||||
|         @surfaces = map $_->offset(-$distance), @surfaces; | ||||
|     } | ||||
|      | ||||
|     my @fills = (); | ||||
|  |  | |||
|  | @ -256,10 +256,13 @@ sub make_perimeters { | |||
|          | ||||
|         # create one more offset to be used as boundary for fill | ||||
|         { | ||||
|             # we offset by half the perimeter spacing (to get to the actual infill boundary) | ||||
|             # and then we offset back and forth by the infill spacing to only consider the | ||||
|             # non-collapsing regions | ||||
|             my @fill_boundaries = @{union_ex([ | ||||
|                 Slic3r::Geometry::Clipper::offset( | ||||
|                     [Slic3r::Geometry::Clipper::offset([ map @$_, @last_offsets ], -($perimeter_spacing/2 + $infill_spacing))],  | ||||
|                     +0.5*$infill_spacing, | ||||
|                     +$infill_spacing, | ||||
|                 ), | ||||
|             ])}; | ||||
|             $_->simplify(&Slic3r::SCALED_RESOLUTION) for @fill_boundaries; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci