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
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/geometry.t
parent95f7bcb9fef03d3f9fc35a3c3358be5a10bc75c3 (diff)
Fixed wrong implementation of concave_points() and convex_points() in C++. #2384
Diffstat (limited to 't/geometry.t')
-rw-r--r--t/geometry.t28
1 files changed, 27 insertions, 1 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__