Refactoring, new size_3D function

degen-loop-screen
Alessandro Ranellucci 2012-09-22 16:12:54 +02:00
parent b5672de3ca
commit 82ac4722d2
2 changed files with 9 additions and 4 deletions

View File

@ -20,7 +20,7 @@ our @EXPORT_OK = qw(
shortest_path collinear scale unscale merge_collinear_lines shortest_path collinear scale unscale merge_collinear_lines
rad2deg_dir bounding_box_center line_intersects_any douglas_peucker rad2deg_dir bounding_box_center line_intersects_any douglas_peucker
polyline_remove_short_segments normal triangle_normal polygon_is_convex polyline_remove_short_segments normal triangle_normal polygon_is_convex
scaled_epsilon bounding_box_3D scaled_epsilon bounding_box_3D size_3D
); );
@ -721,6 +721,13 @@ sub bounding_box_3D {
return @extents; return @extents;
} }
sub size_3D {
my ($points) = @_;
my @extents = bounding_box_3D($points);
return map $extents[$_][MAX] - $extents[$_][MIN], (X,Y,Z);
}
sub angle3points { sub angle3points {
my ($p1, $p2, $p3) = @_; my ($p1, $p2, $p3) = @_;
# p1 is the center # p1 is the center

View File

@ -386,9 +386,7 @@ sub extents {
sub size { sub size {
my $self = shift; my $self = shift;
return Slic3r::Geometry::size_3D($self->vertices);
my @extents = $self->extents;
return map $extents[$_][MAX] - $extents[$_][MIN], (X,Y,Z);
} }
sub slice_facet { sub slice_facet {