Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2014-12-07 21:53:22 +0300
committerAlessandro Ranellucci <aar@cpan.org>2014-12-07 21:53:22 +0300
commit6ce651eb4ae0fab4d99ef73d176e2a614e0e710c (patch)
treecfce38aa3ec9a27cfbd84e11669e63b068874ce4 /t
parent95f7bcb9fef03d3f9fc35a3c3358be5a10bc75c3 (diff)
Fixed wrong implementation of concave_points() and convex_points() in C++. #2384
Diffstat (limited to 't')
-rw-r--r--t/geometry.t28
-rw-r--r--t/perimeters.t2
2 files changed, 28 insertions, 2 deletions
diff --git a/t/geometry.t b/t/geometry.t
index 24fbf52d9..d85c8bbcf 100644
--- a/t/geometry.t
+++ b/t/geometry.t
@@ -2,7 +2,7 @@ use Test::More;
use strict;
use warnings;
-plan tests => 33;
+plan tests => 38;
BEGIN {
use FindBin;
@@ -213,3 +213,29 @@ my $polygons = [
is scalar(@{$square->concave_points(PI*4/3)}), 0, 'no concave vertices detected in convex polygon';
is scalar(@{$square->convex_points(PI*2/3)}), 4, 'four convex vertices detected in square';
}
+
+{
+ my $triangle = Slic3r::Polygon->new(
+ [16000170,26257364], [714223,461012], [31286371,461008],
+ );
+ is scalar(@{$triangle->concave_points(PI*4/3)}), 0, 'no concave vertices detected in triangle';
+ is scalar(@{$triangle->convex_points(PI*2/3)}), 3, 'three convex vertices detected in triangle';
+}
+
+{
+ my $triangle = Slic3r::Polygon->new(
+ [16000170,26257364], [714223,461012], [20000000,461012], [31286371,461012],
+ );
+ is scalar(@{$triangle->concave_points(PI*4/3)}), 0, 'no concave vertices detected in triangle having collinear point';
+ is scalar(@{$triangle->convex_points(PI*2/3)}), 3, 'three convex vertices detected in triangle having collinear point';
+}
+
+{
+ my $triangle = Slic3r::Polygon->new(
+ [16000170,26257364], [714223,461012], [31286371,461008],
+ );
+ my $simplified = $triangle->simplify(250000)->[0];
+ is scalar(@$simplified), 3, 'triangle is never simplified to less than 3 points';
+}
+
+__END__
diff --git a/t/perimeters.t b/t/perimeters.t
index 17e1b31c7..49217fd82 100644
--- a/t/perimeters.t
+++ b/t/perimeters.t
@@ -266,7 +266,7 @@ use Slic3r::Test;
my $was_extruding = 0;
my @seam_points = ();
my $print = Slic3r::Test::init_print($model_name, config => $config);
- Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
+ Slic3r::GCode::Reader->new->parse(my $gcode = Slic3r::Test::gcode($print), sub {
my ($self, $cmd, $args, $info) = @_;
if ($info->{extruding}) {