mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Fixed wrong implementation of concave_points() and convex_points() in C++. #2384
This commit is contained in:
		
							parent
							
								
									95f7bcb9fe
								
							
						
					
					
						commit
						6ce651eb4a
					
				
					 7 changed files with 53 additions and 18 deletions
				
			
		
							
								
								
									
										28
									
								
								t/geometry.t
									
										
									
									
									
								
							
							
						
						
									
										28
									
								
								t/geometry.t
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2,7 +2,7 @@ use Test::More;
 | 
			
		|||
use strict;
 | 
			
		||||
use warnings;
 | 
			
		||||
 | 
			
		||||
plan tests => 33;
 | 
			
		||||
plan tests => 38;
 | 
			
		||||
 | 
			
		||||
BEGIN {
 | 
			
		||||
    use FindBin;
 | 
			
		||||
| 
						 | 
				
			
			@ -213,3 +213,29 @@ my $polygons = [
 | 
			
		|||
    is scalar(@{$square->concave_points(PI*4/3)}), 0, 'no concave vertices detected in convex polygon';
 | 
			
		||||
    is scalar(@{$square->convex_points(PI*2/3)}), 4, 'four convex vertices detected in square';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    my $triangle = Slic3r::Polygon->new(
 | 
			
		||||
        [16000170,26257364], [714223,461012], [31286371,461008],
 | 
			
		||||
    );
 | 
			
		||||
    is scalar(@{$triangle->concave_points(PI*4/3)}), 0, 'no concave vertices detected in triangle';
 | 
			
		||||
    is scalar(@{$triangle->convex_points(PI*2/3)}), 3, 'three convex vertices detected in triangle';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    my $triangle = Slic3r::Polygon->new(
 | 
			
		||||
        [16000170,26257364], [714223,461012], [20000000,461012], [31286371,461012],
 | 
			
		||||
    );
 | 
			
		||||
    is scalar(@{$triangle->concave_points(PI*4/3)}), 0, 'no concave vertices detected in triangle having collinear point';
 | 
			
		||||
    is scalar(@{$triangle->convex_points(PI*2/3)}), 3, 'three convex vertices detected in triangle having collinear point';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    my $triangle = Slic3r::Polygon->new(
 | 
			
		||||
        [16000170,26257364], [714223,461012], [31286371,461008],
 | 
			
		||||
    );
 | 
			
		||||
    my $simplified = $triangle->simplify(250000)->[0];
 | 
			
		||||
    is scalar(@$simplified), 3, 'triangle is never simplified to less than 3 points';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__END__
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue