mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 01:37:53 -06:00
Promising approach to medial axis pruning
This commit is contained in:
parent
8644440070
commit
3c77b301a7
13 changed files with 126 additions and 326 deletions
|
@ -5,7 +5,7 @@ use warnings;
|
|||
require Exporter;
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT_OK = qw(
|
||||
PI X Y Z A B X1 Y1 X2 Y2 Z1 Z2 MIN MAX epsilon slope line_atan lines_parallel
|
||||
PI X Y Z A B X1 Y1 X2 Y2 Z1 Z2 MIN MAX epsilon slope
|
||||
line_point_belongs_to_segment points_coincide distance_between_points
|
||||
normalize tan move_points_3D
|
||||
point_in_polygon point_in_segment segment_in_segment
|
||||
|
@ -15,7 +15,7 @@ our @EXPORT_OK = qw(
|
|||
rotate_points move_points
|
||||
dot perp polygon_points_visibility
|
||||
line_intersection bounding_box bounding_box_intersect
|
||||
angle3points three_points_aligned line_direction
|
||||
angle3points
|
||||
chained_path chained_path_from collinear scale unscale
|
||||
rad2deg_dir bounding_box_center line_intersects_any douglas_peucker
|
||||
polyline_remove_short_segments normal triangle_normal polygon_is_convex
|
||||
|
@ -57,30 +57,6 @@ sub slope {
|
|||
return ($line->[B][Y] - $line->[A][Y]) / ($line->[B][X] - $line->[A][X]);
|
||||
}
|
||||
|
||||
sub line_atan {
|
||||
my ($line) = @_;
|
||||
return atan2($line->[B][Y] - $line->[A][Y], $line->[B][X] - $line->[A][X]);
|
||||
}
|
||||
|
||||
sub line_direction {
|
||||
my ($line) = @_;
|
||||
my $atan2 = line_atan($line);
|
||||
return ($atan2 == PI) ? 0
|
||||
: ($atan2 < 0) ? ($atan2 + PI)
|
||||
: $atan2;
|
||||
}
|
||||
|
||||
sub lines_parallel {
|
||||
my ($line1, $line2) = @_;
|
||||
|
||||
return abs(line_direction($line1) - line_direction($line2)) < $parallel_degrees_limit;
|
||||
}
|
||||
|
||||
sub three_points_aligned {
|
||||
my ($p1, $p2, $p3) = @_;
|
||||
return lines_parallel([$p1, $p2], [$p2, $p3]);
|
||||
}
|
||||
|
||||
# this subroutine checks whether a given point may belong to a given
|
||||
# segment given the hypothesis that it belongs to the line containing
|
||||
# the segment
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue