mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Refactoring: move direction math into a single function. Includes some fixes and adjustments
This commit is contained in:
		
							parent
							
								
									8240f71d07
								
							
						
					
					
						commit
						cb1527f7ef
					
				
					 9 changed files with 59 additions and 13 deletions
				
			
		|  | @ -4,7 +4,9 @@ use strict; | |||
| use warnings; | ||||
| 
 | ||||
| use Slic3r::XS; | ||||
| use Test::More tests => 2; | ||||
| use Test::More tests => 8; | ||||
| 
 | ||||
| use constant PI => 4 * atan2(1, 1); | ||||
| 
 | ||||
| { | ||||
|     my @points = ( | ||||
|  | @ -19,4 +21,14 @@ use Test::More tests => 2; | |||
|     is scalar(@$hull), 4, 'convex_hull returns the correct number of points'; | ||||
| } | ||||
| 
 | ||||
| # directions_parallel() and directions_parallel_within() are tested | ||||
| # also with Slic3r::Line::parallel_to() tests in 10_line.t | ||||
| { | ||||
|     ok Slic3r::Geometry::directions_parallel_within(0, 0, 0), 'directions_parallel_within'; | ||||
|     ok Slic3r::Geometry::directions_parallel_within(0, PI, 0), 'directions_parallel_within'; | ||||
|     ok Slic3r::Geometry::directions_parallel_within(0, 0, PI/180), 'directions_parallel_within'; | ||||
|     ok Slic3r::Geometry::directions_parallel_within(0, PI, PI/180), 'directions_parallel_within'; | ||||
|     ok !Slic3r::Geometry::directions_parallel_within(PI/2, PI, 0), 'directions_parallel_within'; | ||||
|     ok !Slic3r::Geometry::directions_parallel_within(PI/2, PI, PI/180), 'directions_parallel_within'; | ||||
| } | ||||
| __END__ | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci