mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Fix regression in chained_path() introduced in fb763b0187. Includes regression test. #1184
				
					
				
			This commit is contained in:
		
							parent
							
								
									4755e61d71
								
							
						
					
					
						commit
						849d69d178
					
				
					 2 changed files with 14 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -800,7 +800,7 @@ sub chained_path {
 | 
			
		|||
    }
 | 
			
		||||
    while (@points) {
 | 
			
		||||
        my $idx = $start_near->nearest_point_index(\@points);
 | 
			
		||||
        my ($start_near) = splice @points, $idx, 1;
 | 
			
		||||
        ($start_near) = splice @points, $idx, 1;
 | 
			
		||||
        push @result, $indices{$start_near};
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										15
									
								
								t/geometry.t
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								t/geometry.t
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2,7 +2,7 @@ use Test::More;
 | 
			
		|||
use strict;
 | 
			
		||||
use warnings;
 | 
			
		||||
 | 
			
		||||
plan tests => 25;
 | 
			
		||||
plan tests => 26;
 | 
			
		||||
 | 
			
		||||
BEGIN {
 | 
			
		||||
    use FindBin;
 | 
			
		||||
| 
						 | 
				
			
			@ -12,7 +12,8 @@ BEGIN {
 | 
			
		|||
use Slic3r;
 | 
			
		||||
use Slic3r::Geometry qw(PI polyline_remove_parallel_continuous_edges 
 | 
			
		||||
    polyline_remove_acute_vertices polygon_remove_acute_vertices
 | 
			
		||||
    polygon_remove_parallel_continuous_edges polygon_is_convex);
 | 
			
		||||
    polygon_remove_parallel_continuous_edges polygon_is_convex
 | 
			
		||||
    chained_path_points epsilon scale);
 | 
			
		||||
 | 
			
		||||
#==========================================================
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -190,3 +191,13 @@ is Slic3r::Geometry::can_connect_points(@$points, $polygons), 0, 'can_connect_po
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
#==========================================================
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    # if chained_path() works correctly, these points should be joined with no diagonal paths
 | 
			
		||||
    # (thus 26 units long)
 | 
			
		||||
    my @points = map Slic3r::Point->new_scale(@$_), [26,26],[52,26],[0,26],[26,52],[26,0],[0,52],[52,52],[52,0];
 | 
			
		||||
    my @ordered = @{chained_path_points(\@points, $points[0])};
 | 
			
		||||
    ok !(grep { abs($ordered[$_]->distance_to($ordered[$_+1]) - scale 26) > epsilon } 0..$#ordered-1), 'chained_path';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#==========================================================
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue