diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2011-10-04 19:55:55 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2011-10-04 19:55:55 +0400 |
commit | 794b7a99d2ac4ffd1d204bf08a5a31a2121d8db7 (patch) | |
tree | 97335855af90efc6c08d890f00b3ac4128f515c4 /lib/Slic3r/Geometry.pm | |
parent | 6444c3d7a960a72ca40273f483dfe5d9e2e66244 (diff) |
Fixes for hi-res STL models
Diffstat (limited to 'lib/Slic3r/Geometry.pm')
-rw-r--r-- | lib/Slic3r/Geometry.pm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Slic3r/Geometry.pm b/lib/Slic3r/Geometry.pm index 918422c78..ce827be9d 100644 --- a/lib/Slic3r/Geometry.pm +++ b/lib/Slic3r/Geometry.pm @@ -10,7 +10,7 @@ use constant A => 0; use constant B => 1; use constant X => 0; use constant Y => 1; -use constant epsilon => 1E-8; +use constant epsilon => 1E-6; use constant epsilon2 => epsilon**2; our $parallel_degrees_limit = abs(deg2rad(3)); @@ -170,4 +170,13 @@ sub move_points { return map [ $shift->[X] + $_->[X], $shift->[Y] + $_->[Y] ], @points; } +# preserves order +sub remove_coinciding_points { + my ($points) = @_; + + my %p = map { sprintf('%f,%f', @$_) => "$_" } @$points; + %p = reverse %p; + @$points = grep $p{"$_"}, @$points; +} + 1; |