Merge branch 'master' into grow-narrow

This commit is contained in:
Alessandro Ranellucci 2013-03-13 16:39:57 +01:00
commit f528088d31
5 changed files with 26 additions and 14 deletions

View File

@ -26,6 +26,7 @@ my $build = Module::Build->new(
'IO::Scalar' => '0.10',
},
recommends => {
'Class::XSAccessor' => '0',
'Growl::GNTP' => '0.15',
'Net::DBus' => '0',
'XML::SAX::ExpatXS' => '0',

View File

@ -991,7 +991,11 @@ END
};
# generate accessors
{
if (eval "use Class::XSAccessor; 1") {
Class::XSAccessor->import(
getters => { map { $_ => $_ } keys %$Options },
);
} else {
no strict 'refs';
for my $opt_key (keys %$Options) {
*{$opt_key} = sub { $_[0]{$opt_key} };

View File

@ -229,15 +229,7 @@ sub point_is_on_left_of_segment {
sub polyline_lines {
my ($polygon) = @_;
my @lines = ();
my $last_point;
foreach my $point (@$polygon) {
push @lines, Slic3r::Line->new($last_point, $point) if $last_point;
$last_point = $point;
}
return @lines;
return map Slic3r::Line->new($polygon->[$_], $polygon->[$_+1]), 0 .. $#$polygon-1;
}
sub polygon_lines {

View File

@ -39,6 +39,21 @@ sub depth_layers { $_[0][S_DEPTH_LAYERS] } # this integer represents the thic
sub bridge_angle { $_[0][S_BRIDGE_ANGLE] = $_[1] if defined $_[1]; $_[0][S_BRIDGE_ANGLE] }
sub extra_perimeters { $_[0][S_EXTRA_PERIMETERS] = $_[1] if defined $_[1]; $_[0][S_EXTRA_PERIMETERS] }
if (eval "use Class::XSAccessor::Array; 1") {
Class::XSAccessor::Array->import(
getters => {
expolygon => S_EXPOLYGON,
},
accessors => {
surface_type => S_SURFACE_TYPE,
depth_layers => S_DEPTH_LAYERS,
bridge_angle => S_BRIDGE_ANGLE,
extra_perimeters => S_EXTRA_PERIMETERS,
},
replace => 1,
);
}
# delegate handles
sub encloses_point { $_[0]->expolygon->encloses_point }
sub lines { $_[0]->expolygon->lines }

View File

@ -163,10 +163,10 @@ sub check_manifoldness {
sub unpack_line {
my ($packed) = @_;
my @data = unpack I_FMT, $packed;
splice @data, 0, 2, [ @data[0,1] ];
$data[$_] = undef for grep $data[$_] == -1, I_A_ID, I_B_ID, I_FACET_EDGE, I_PREV_FACET_INDEX, I_NEXT_FACET_INDEX;
return [@data];
my $data = [ unpack I_FMT, $packed ];
splice @$data, 0, 2, [ @$data[0,1] ];
$data->[$_] = undef for grep $data->[$_] == -1, I_A_ID, I_B_ID, I_FACET_EDGE, I_PREV_FACET_INDEX, I_NEXT_FACET_INDEX;
return $data;
}
sub make_loops {