mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-23 14:44:19 -06:00
Thin walls. #24
This commit is contained in:
parent
62ee79f0c9
commit
1c7564e4a4
12 changed files with 203 additions and 12 deletions
|
@ -18,7 +18,8 @@ our @EXPORT_OK = qw(
|
|||
polyline_remove_parallel_continuous_edges polyline_remove_acute_vertices
|
||||
polygon_remove_acute_vertices polygon_remove_parallel_continuous_edges
|
||||
shortest_path collinear scale unscale merge_collinear_lines
|
||||
rad2deg_dir bounding_box_center
|
||||
rad2deg_dir bounding_box_center line_intersects_any
|
||||
polyline_remove_short_segments
|
||||
);
|
||||
|
||||
use Slic3r::Geometry::DouglasPeucker qw(Douglas_Peucker);
|
||||
|
@ -66,7 +67,7 @@ sub line_direction {
|
|||
sub lines_parallel {
|
||||
my ($line1, $line2) = @_;
|
||||
|
||||
return abs(line_atan($line1) - line_atan($line2)) < $parallel_degrees_limit;
|
||||
return abs(line_direction($line1) - line_direction($line2)) < $parallel_degrees_limit;
|
||||
}
|
||||
|
||||
sub three_points_aligned {
|
||||
|
@ -438,6 +439,14 @@ sub polygon_points_visibility {
|
|||
return 1;
|
||||
}
|
||||
|
||||
sub line_intersects_any {
|
||||
my ($line, $lines) = @_;
|
||||
for (@$lines) {
|
||||
return 1 if line_intersection($line, $_, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub line_intersection {
|
||||
my ($line1, $line2, $require_crossing) = @_;
|
||||
$require_crossing ||= 0;
|
||||
|
@ -676,6 +685,17 @@ sub polygon_remove_acute_vertices {
|
|||
return polyline_remove_acute_vertices($points, 1);
|
||||
}
|
||||
|
||||
sub polyline_remove_short_segments {
|
||||
my ($points, $min_length, $isPolygon) = @_;
|
||||
for (my $i = $isPolygon ? 0 : 1; $i < $#$points; $i++) {
|
||||
if (distance_between_points($points->[$i-1], $points->[$i]) < $min_length) {
|
||||
# we can remove $points->[$i]
|
||||
splice @$points, $i, 1;
|
||||
$i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# accepts an arrayref; each item should be an arrayref whose first
|
||||
# item is the point to be used for the shortest path, and the second
|
||||
# one is the value to be returned in output (if the second item
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue