Switch print_z to unscaled coordinates

This commit is contained in:
Alessandro Ranellucci 2013-07-29 00:27:53 +02:00
parent 3bcb2f04ed
commit 51de3ce14f
5 changed files with 11 additions and 12 deletions

View file

@ -25,7 +25,7 @@ sub export_svg {
my ($filename) = @_;
my $print_size = $self->print->size;
$self->height(unscale max(map $_->print_z, map @{$_->layers}, @{$self->print->objects}));
$self->height(max(map $_->print_z, map @{$_->layers}, @{$self->print->objects}));
my $svg = SVG->new(
width => $self->scale * unscale($print_size->[X]),
height => $self->scale * $self->height,
@ -106,7 +106,7 @@ sub _plot {
# we're cutting the path in the longitudinal direction, so we've got a rectangle
push @rectangles, {
'x' => $self->scale * unscale $line->[A][X],
'y' => $self->scale * $self->_y(unscale($layer->print_z)),
'y' => $self->scale * $self->_y($layer->print_z),
'width' => $self->scale * $width,
'height' => $self->scale * $radius * 2,
'rx' => $self->scale * $radius * 0.35,
@ -115,7 +115,7 @@ sub _plot {
} else {
push @circles, {
'cx' => $self->scale * (unscale($line->[A][X]) + $radius),
'cy' => $self->scale * $self->_y(unscale($layer->print_z) - $radius),
'cy' => $self->scale * $self->_y($layer->print_z - $radius),
'r' => $self->scale * $radius,
};
}
@ -125,7 +125,7 @@ sub _plot {
my $height = $path->height // $layer->height;
{
'x' => $self->scale * unscale $_->[A][X],
'y' => $self->scale * $self->_y(unscale($layer->print_z)),
'y' => $self->scale * $self->_y($layer->print_z),
'width' => $self->scale * unscale(abs($_->[B][X] - $_->[A][X])),
'height' => $self->scale * $height,
'rx' => $self->scale * $height * 0.35,