Make plater work with XS data in single-thread environment
This commit is contained in:
parent
87a5de193d
commit
fb7cea3cb9
@ -94,6 +94,7 @@ sub union_ex {
|
|||||||
my ($polygons, $jointype, $safety_offset) = @_;
|
my ($polygons, $jointype, $safety_offset) = @_;
|
||||||
$jointype = PFT_NONZERO unless defined $jointype;
|
$jointype = PFT_NONZERO unless defined $jointype;
|
||||||
$clipper->clear;
|
$clipper->clear;
|
||||||
|
$polygons = $polygons->arrayref if ref $polygons eq 'Slic3r::ExPolygon::XS';
|
||||||
$clipper->add_subject_polygons($safety_offset ? safety_offset($polygons) : $polygons);
|
$clipper->add_subject_polygons($safety_offset ? safety_offset($polygons) : $polygons);
|
||||||
return [
|
return [
|
||||||
map Slic3r::ExPolygon::XS->new($_->{outer}, @{$_->{holes}}),
|
map Slic3r::ExPolygon::XS->new($_->{outer}, @{$_->{holes}}),
|
||||||
|
@ -533,6 +533,7 @@ sub horizontal_projection {
|
|||||||
my $scale_vector = Math::Clipper::integerize_coordinate_sets({ bits => 32 }, @f);
|
my $scale_vector = Math::Clipper::integerize_coordinate_sets({ bits => 32 }, @f);
|
||||||
$_->make_counter_clockwise for @f; # do this after scaling, as winding order might change while doing that
|
$_->make_counter_clockwise for @f; # do this after scaling, as winding order might change while doing that
|
||||||
my $union = union_ex([ Slic3r::Geometry::Clipper::offset(\@f, 10000) ]);
|
my $union = union_ex([ Slic3r::Geometry::Clipper::offset(\@f, 10000) ]);
|
||||||
|
$union = [ map $_->arrayref, @$union ];
|
||||||
Math::Clipper::unscale_coordinate_sets($scale_vector, $_) for @$union;
|
Math::Clipper::unscale_coordinate_sets($scale_vector, $_) for @$union;
|
||||||
return $union;
|
return $union;
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,9 @@ extern "C" {
|
|||||||
class Point
|
class Point
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
unsigned long x;
|
long x;
|
||||||
unsigned long y;
|
long y;
|
||||||
Point(unsigned long _x = 0, unsigned long _y = 0): x(_x), y(_y) {};
|
Point(long _x = 0, long _y = 0): x(_x), y(_y) {};
|
||||||
void rotate(double angle, Point* center);
|
void rotate(double angle, Point* center);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -24,8 +24,8 @@ Point::rotate(double angle, Point* center)
|
|||||||
{
|
{
|
||||||
double cur_x = (double)x;
|
double cur_x = (double)x;
|
||||||
double cur_y = (double)y;
|
double cur_y = (double)y;
|
||||||
x = (unsigned long)( (double)center->x + cos(angle) * (cur_x - (double)center->x) - sin(angle) * (cur_y - (double)center->y) );
|
x = (long)( (double)center->x + cos(angle) * (cur_x - (double)center->x) - sin(angle) * (cur_y - (double)center->y) );
|
||||||
y = (unsigned long)( (double)center->y + cos(angle) * (cur_y - (double)center->y) + sin(angle) * (cur_x - (double)center->x) );
|
y = (long)( (double)center->y + cos(angle) * (cur_y - (double)center->y) + sin(angle) * (cur_x - (double)center->x) );
|
||||||
}
|
}
|
||||||
|
|
||||||
SV*
|
SV*
|
||||||
|
Loading…
Reference in New Issue
Block a user