New module to output SVG vertical sections of extrusion paths with real width and height. The commit includes a bugfix to the Polyline->grow() method and some simplification in the Line class which is now child of Polyline

This commit is contained in:
Alessandro Ranellucci 2013-04-27 15:02:13 +02:00
parent 6842114d3d
commit bc9ff47d3f
7 changed files with 138 additions and 45 deletions

View file

@ -2,7 +2,9 @@ package Slic3r::Line;
use strict;
use warnings;
use Boost::Geometry::Utils;
# a line is a two-points line
use parent 'Slic3r::Polyline';
use Slic3r::Geometry qw(A B X Y);
sub new {
@ -14,11 +16,6 @@ sub new {
return $self;
}
sub boost_linestring {
my $self = shift;
return Boost::Geometry::Utils::linestring($self);
}
sub coincides_with {
my $self = shift;
my ($line) = @_;
@ -27,11 +24,6 @@ sub coincides_with {
|| ($self->a->coincides_with($line->b) && $self->b->coincides_with($line->a));
}
sub length {
my $self = shift;
return Boost::Geometry::Utils::linestring_length($self);
}
sub vector {
my $self = shift;
return (ref $self)->new([0,0], [map $self->[B][$_] - $self->[A][$_], X,Y]);
@ -67,17 +59,4 @@ sub midpoint {
);
}
sub reverse {
my $self = shift;
@$self = reverse @$self;
}
sub translate {
my $self = shift;
my ($x, $y) = @_;
@$self = Slic3r::Geometry::move_points([$x, $y], @$self);
bless $_, 'Slic3r::Point' for @$self;
return $self;
}
1;