diff options
author | Vojtech Bubnik <bubnikv@gmail.com> | 2021-02-09 20:36:28 +0300 |
---|---|---|
committer | Vojtech Bubnik <bubnikv@gmail.com> | 2021-02-09 20:36:28 +0300 |
commit | 2e55898d78ddca4753adb60c9222c52bc9ee8ba8 (patch) | |
tree | 23cca718fbe941bba6be23299065d0e60bbeefeb /xs | |
parent | 820c18923b4543cd8f878ba4f0071c1f73708347 (diff) |
Removal of not numerically robust libraries "poly2tree" and "polypartition".
Adjustment of GUI/3DBed.cpp,hpp to use the more stable triangulation algoritm
derived from SGI glut.
Fix of an extremely slow bridging calculation, caused by an extremely
slow bridged area detection function, of which the results were never used.
Fixes "slicing fails or takes too long #5974"
Diffstat (limited to 'xs')
-rw-r--r-- | xs/t/04_expolygon.t | 30 | ||||
-rw-r--r-- | xs/xsp/ExPolygon.xsp | 4 | ||||
-rw-r--r-- | xs/xsp/Layer.xsp | 2 |
3 files changed, 1 insertions, 35 deletions
diff --git a/xs/t/04_expolygon.t b/xs/t/04_expolygon.t index 39da22f0a..65e274ab9 100644 --- a/xs/t/04_expolygon.t +++ b/xs/t/04_expolygon.t @@ -5,7 +5,7 @@ use warnings; use List::Util qw(first sum); use Slic3r::XS; -use Test::More tests => 31; +use Test::More tests => 21; use constant PI => 4 * atan2(1, 1); @@ -105,32 +105,4 @@ is $expolygon->area, 100*100-20*20, 'area'; is_deeply $collection->[0]->clone->pp, $collection->[0]->pp, 'clone collection item'; } -{ - my $expolygon = Slic3r::ExPolygon->new($square); - my $polygons = $expolygon->get_trapezoids2(PI/2); - is scalar(@$polygons), 1, 'correct number of trapezoids returned'; - is scalar(@{$polygons->[0]}), 4, 'trapezoid has 4 points'; - is $polygons->[0]->area, $expolygon->area, 'trapezoid has correct area'; -} - -{ - my $polygons = $expolygon->get_trapezoids2(PI/2); - is scalar(@$polygons), 4, 'correct number of trapezoids returned'; - - # trapezoid polygons might have more than 4 points in case of collinear segments - $polygons = [ map @{$_->simplify(1)}, @$polygons ]; - ok !defined(first { @$_ != 4 } @$polygons), 'all trapezoids have 4 points'; - - is scalar(grep { $_->area == 40*100 } @$polygons), 2, 'trapezoids have expected area'; - is scalar(grep { $_->area == 20*40 } @$polygons), 2, 'trapezoids have expected area'; -} - -{ - my $expolygon = Slic3r::ExPolygon->new([ [0,100],[100,0],[200,0],[300,100],[200,200],[100,200] ]); - my $polygons = $expolygon->get_trapezoids2(PI/2); - is scalar(@$polygons), 3, 'correct number of trapezoids returned'; - is scalar(grep { $_->area == 100*200/2 } @$polygons), 2, 'trapezoids have expected area'; - is scalar(grep { $_->area == 100*200 } @$polygons), 1, 'trapezoids have expected area'; -} - __END__ diff --git a/xs/xsp/ExPolygon.xsp b/xs/xsp/ExPolygon.xsp index bb138732f..a57bcfbcb 100644 --- a/xs/xsp/ExPolygon.xsp +++ b/xs/xsp/ExPolygon.xsp @@ -31,10 +31,6 @@ Polygons simplify_p(double tolerance); Polylines medial_axis(double max_width, double min_width) %code{% THIS->medial_axis(max_width, min_width, &RETVAL); %}; - Polygons get_trapezoids2(double angle) - %code{% THIS->get_trapezoids2(&RETVAL, angle); %}; - Polygons triangulate() - %code{% THIS->triangulate(&RETVAL); %}; %{ ExPolygon* diff --git a/xs/xsp/Layer.xsp b/xs/xsp/Layer.xsp index fdcc26eb6..5d006e676 100644 --- a/xs/xsp/Layer.xsp +++ b/xs/xsp/Layer.xsp @@ -18,8 +18,6 @@ %code%{ RETVAL = &THIS->thin_fills; %}; Ref<SurfaceCollection> fill_surfaces() %code%{ RETVAL = &THIS->fill_surfaces; %}; - Polygons bridged() - %code%{ RETVAL = THIS->bridged; %}; Ref<ExtrusionEntityCollection> perimeters() %code%{ RETVAL = &THIS->perimeters; %}; Ref<ExtrusionEntityCollection> fills() |