mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-08 06:24:01 -06:00
Ported horizontal_projection() to XS
This commit is contained in:
parent
e75dbf37fa
commit
4d5d003ba7
4 changed files with 27 additions and 20 deletions
|
@ -29,24 +29,4 @@ sub bounding_box {
|
|||
return Slic3r::Geometry::BoundingBox->new_from_bb($self->bb3);
|
||||
}
|
||||
|
||||
# this will return *scaled* expolygons, so it is expected to be run
|
||||
# on unscaled meshes
|
||||
sub horizontal_projection {
|
||||
my $self = shift;
|
||||
|
||||
my ($facets, $vertices) = ($self->facets, $self->vertices);
|
||||
|
||||
my @f = ();
|
||||
foreach my $facet (@$facets) {
|
||||
push @f, Slic3r::Polygon->new(
|
||||
map [ map $_ / &Slic3r::SCALING_FACTOR, @{$vertices->[$_]}[X,Y] ], @$facet
|
||||
);
|
||||
}
|
||||
|
||||
$_->make_counter_clockwise for @f; # do this after scaling, as winding order might change while doing that
|
||||
|
||||
# the offset factor was tuned using groovemount.stl
|
||||
return union_ex(offset(\@f, Slic3r::Geometry::scale 0.01), 1);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue