mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 23:23:59 -06:00
New option to customize infill angle
This commit is contained in:
parent
742f646372
commit
b0433097d4
6 changed files with 48 additions and 14 deletions
|
@ -4,6 +4,7 @@ use warnings;
|
|||
|
||||
use XXX;
|
||||
|
||||
use constant PI => 4 * atan2(1, 1);
|
||||
use constant A => 0;
|
||||
use constant B => 1;
|
||||
use constant X => 0;
|
||||
|
@ -145,4 +146,25 @@ sub point_along_segment {
|
|||
return $point;
|
||||
}
|
||||
|
||||
sub deg2rad {
|
||||
my ($degrees) = @_;
|
||||
return PI() * $degrees / 180;
|
||||
}
|
||||
|
||||
sub rotate_points {
|
||||
my ($radians, $center, @points) = @_;
|
||||
$center ||= [0,0];
|
||||
return map {
|
||||
[
|
||||
$center->[X] + cos($radians) * ($_->[X] - $center->[X]) - sin($radians) * ($_->[Y] - $center->[Y]),
|
||||
$center->[Y] + cos($radians) * ($_->[Y] - $center->[Y]) + sin($radians) * ($_->[X] - $center->[X]),
|
||||
]
|
||||
} @points;
|
||||
}
|
||||
|
||||
sub move_points {
|
||||
my ($shift, @points) = @_;
|
||||
return map [ $shift->[X] + $_->[X], $shift->[Y] + $_->[Y] ], @points;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue