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:
authorbubnikv <bubnikv@gmail.com>2017-04-26 15:24:31 +0300
committerbubnikv <bubnikv@gmail.com>2017-04-26 15:24:31 +0300
commit72ae3585e415189286cdb85f6e02e4ec150084ee (patch)
tree971e028ac88abac78c9a119aeb072a1f3c5d1879 /t
parente918ea9c65b7db75842f5947af5c1bce30a8535b (diff)
Removed a broken Arc Fitting feature.
Removed the questionable Pressure Advance feature. It is better to use the Pressure Advance implemented into a firmware. Added a C++ implementation of GCodeReader and SpiralVase, thanks to @alexrj Added a C++ implementation of GCodeTimeEstimator, thanks to @lordofhyphens
Diffstat (limited to 't')
-rw-r--r--t/arcs.t122
-rw-r--r--t/pressure.t36
2 files changed, 0 insertions, 158 deletions
diff --git a/t/arcs.t b/t/arcs.t
deleted file mode 100644
index 65b83de43..000000000
--- a/t/arcs.t
+++ /dev/null
@@ -1,122 +0,0 @@
-use Test::More;
-use strict;
-use warnings;
-
-plan tests => 24;
-
-BEGIN {
- use FindBin;
- use lib "$FindBin::Bin/../lib";
-}
-
-use Slic3r;
-use Slic3r::ExtrusionPath ':roles';
-use Slic3r::Geometry qw(scaled_epsilon epsilon scale unscale X Y deg2rad);
-
-{
- my $angle = deg2rad(4);
- foreach my $ccw (1, 0) {
- my $polyline = Slic3r::Polyline->new_scale([0,0], [0,10]);
- {
- my $p3 = Slic3r::Point->new_scale(0, 20);
- $p3->rotate($angle * ($ccw ? 1 : -1), $polyline->[-1]);
- is $ccw, ($p3->[X] < $polyline->[-1][X]) ? 1 : 0, 'third point is rotated correctly';
- $polyline->append($p3);
- }
- ok abs($polyline->length - scale(20)) < scaled_epsilon, 'curved polyline length';
- is $ccw, ($polyline->[2]->ccw(@$polyline[0,1]) > 0) ? 1 : 0, 'curved polyline has wanted orientation';
-
- ok my $arc = Slic3r::GCode::ArcFitting::polyline_to_arc($polyline), 'arc is detected';
- is $ccw, $arc->is_ccw, 'arc orientation is correct';
-
- ok abs($arc->angle - $angle) < epsilon, 'arc relative angle is correct';
-
- ok $arc->start->coincides_with($polyline->[0]), 'arc start point is correct';
- ok $arc->end->coincides_with($polyline->[-1]), 'arc end point is correct';
-
- # since first polyline segment is vertical we expect arc center to have same Y as its first point
- is $arc->center->[Y], 0, 'arc center has correct Y';
-
- my $s1 = Slic3r::Line->new(@$polyline[0,1]);
- my $s2 = Slic3r::Line->new(@$polyline[1,2]);
- ok abs($arc->center->distance_to($s1->midpoint) - $arc->center->distance_to($s2->midpoint)) < scaled_epsilon,
- 'arc center is equidistant from both segments\' midpoints';
- }
-}
-
-#==========================================================
-
-{
- my $path = Slic3r::Polyline->new_scale(
- [13.532242,2.665496], [18.702911,9.954623], [22.251514,9.238193], [25.800116,9.954623],
- [28.697942,11.908391], [30.65171,14.806217], [31.36814,18.35482],
- [30.65171,21.903423], [28.697942,24.801249], [25.800116,26.755017], [22.251514,27.471447],
- [18.702911,26.755017], [15.805085,24.801249], [13.851317,21.903423], [13.134887,18.35482],
- [86948.77,175149.09], [119825.35,100585],
- );
-
- if (0) {
- require "Slic3r::SVG";
- Slic3r::SVG::output(
- "arc.svg",
- polylines => [$path],
- );
- }
-
- my $af = Slic3r::GCode::ArcFitting->new(max_relative_angle => deg2rad(30));
- my @chunks = $af->detect_arcs($path);
-
- is scalar(@chunks), 3, 'path collection now contains three paths';
- isa_ok $chunks[0], 'Slic3r::Polyline', 'first one is polyline';
- isa_ok $chunks[1], 'Slic3r::GCode::ArcFitting::Arc', 'second one is arc';
- isa_ok $chunks[2], 'Slic3r::Polyline', 'third one is polyline';
-}
-
-exit;
-
-#==========================================================
-
-{
- my @points = map [ scale $_->[0], scale $_->[1] ], (
- [10,20], [10.7845909572784,19.9691733373313], [11.5643446504023,19.8768834059514],
- [12.3344536385591,19.7236992039768], [13.0901699437495,19.5105651629515],
- [13.8268343236509,19.2387953251129], [14.5399049973955,18.9100652418837],
- [15.2249856471595,18.5264016435409], [15.8778525229247,18.0901699437495],
- [16.4944804833018,17.6040596560003]
- );
- my $path1 = Slic3r::ExtrusionPath->new(
- polyline => Slic3r::Polyline->new(@points),
- role => EXTR_ROLE_FILL,
- mm3_per_mm => 0.5,
- );
- my $path2 = Slic3r::ExtrusionPath->new(
- polyline => Slic3r::Polyline->new(reverse @points),
- role => EXTR_ROLE_FILL,
- mm3_per_mm => 0.5,
- );
-
- my @paths1 = $path1->detect_arcs(10, scale 1);
- my @paths2 = $path2->detect_arcs(10, scale 1);
-
- is scalar(@paths1), 1, 'path collection now contains one path';
- is scalar(@paths2), 1, 'path collection now contains one path';
-
- isa_ok $paths1[0], 'Slic3r::ExtrusionPath::Arc', 'path';
- isa_ok $paths2[0], 'Slic3r::ExtrusionPath::Arc', 'path';
-
- my $expected_length = scale 7.06858347057701;
- ok abs($paths1[0]->length - $expected_length) < scaled_epsilon, 'cw oriented arc has correct length';
- ok abs($paths2[0]->length - $expected_length) < scaled_epsilon, 'ccw oriented arc has correct length';
-
- is $paths1[0]->orientation, 'cw', 'cw orientation was correctly detected';
- is $paths2[0]->orientation, 'ccw', 'ccw orientation was correctly detected';
- is $paths1[0]->flow_spacing, $path1->flow_spacing, 'flow spacing was correctly preserved';
-
- my $center1 = [ map sprintf('%.0f', $_), @{ $paths1[0]->center } ];
- ok abs($center1->[X] - scale 10) < scaled_epsilon && abs($center1->[Y] - scale 10) < scaled_epsilon, 'center was correctly detected';
-
- my $center2 = [ map sprintf('%.0f', $_), @{ $paths2[0]->center } ];
- ok abs($center2->[X] - scale 10) < scaled_epsilon && abs($center1->[Y] - scale 10) < scaled_epsilon, 'center was correctly detected';
-}
-
-#==========================================================
diff --git a/t/pressure.t b/t/pressure.t
deleted file mode 100644
index 6bbb81d84..000000000
--- a/t/pressure.t
+++ /dev/null
@@ -1,36 +0,0 @@
-use Test::More tests => 1;
-use strict;
-use warnings;
-
-BEGIN {
- use FindBin;
- use lib "$FindBin::Bin/../lib";
-}
-
-use List::Util qw();
-use Slic3r;
-use Slic3r::Geometry qw(epsilon);
-use Slic3r::Test;
-
-{
- my $config = Slic3r::Config->new_from_defaults;
- $config->set('pressure_advance', 10);
- $config->set('retract_length', [1]);
-
- my $print = Slic3r::Test::init_print('20mm_cube', config => $config, duplicate => 2);
- my $retracted = $config->retract_length->[0];
- Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
- my ($self, $cmd, $args, $info) = @_;
-
- if ($info->{extruding} && !$info->{dist_XY}) {
- $retracted += $info->{dist_E};
- } elsif ($info->{retracting}) {
- $retracted += $info->{dist_E};
- }
- });
-
- ok abs($retracted) < 0.01, 'all retractions are compensated';
-}
-
-
-__END__