Commenting out untested and unused Polyline::simplify_by_visibility()

This commit is contained in:
Vojtech Bubnik 2021-09-03 16:17:24 +02:00
parent 2e250c1463
commit d154752c38
4 changed files with 39 additions and 39 deletions

View File

@ -120,7 +120,8 @@ void Polyline::simplify(double tolerance)
this->points = MultiPoint::_douglas_peucker(this->points, tolerance); this->points = MultiPoint::_douglas_peucker(this->points, tolerance);
} }
/* This method simplifies all *lines* contained in the supplied area */ #if 0
// This method simplifies all *lines* contained in the supplied area
template <class T> template <class T>
void Polyline::simplify_by_visibility(const T &area) void Polyline::simplify_by_visibility(const T &area)
{ {
@ -141,6 +142,7 @@ void Polyline::simplify_by_visibility(const T &area)
} }
template void Polyline::simplify_by_visibility<ExPolygon>(const ExPolygon &area); template void Polyline::simplify_by_visibility<ExPolygon>(const ExPolygon &area);
template void Polyline::simplify_by_visibility<ExPolygonCollection>(const ExPolygonCollection &area); template void Polyline::simplify_by_visibility<ExPolygonCollection>(const ExPolygonCollection &area);
#endif
void Polyline::split_at(const Point &point, Polyline* p1, Polyline* p2) const void Polyline::split_at(const Point &point, Polyline* p1, Polyline* p2) const
{ {

View File

@ -72,7 +72,7 @@ public:
void extend_start(double distance); void extend_start(double distance);
Points equally_spaced_points(double distance) const; Points equally_spaced_points(double distance) const;
void simplify(double tolerance); void simplify(double tolerance);
template <class T> void simplify_by_visibility(const T &area); // template <class T> void simplify_by_visibility(const T &area);
void split_at(const Point &point, Polyline* p1, Polyline* p2) const; void split_at(const Point &point, Polyline* p1, Polyline* p2) const;
bool is_straight() const; bool is_straight() const;
bool is_closed() const { return this->points.front() == this->points.back(); } bool is_closed() const { return this->points.front() == this->points.back(); }

View File

@ -89,40 +89,40 @@ is_deeply $polyline->pp, [ @$points, @$points ], 'append_polyline';
} }
# disabled because we now use a more efficient but incomplete algorithm # disabled because we now use a more efficient but incomplete algorithm
if (0) { #if (0) {
my $polyline = Slic3r::Polyline->new( # my $polyline = Slic3r::Polyline->new(
map [$_,10], (0,10,20,30,40,50,60) # map [$_,10], (0,10,20,30,40,50,60)
); # );
{ # {
my $expolygon = Slic3r::ExPolygon->new(Slic3r::Polygon->new( # my $expolygon = Slic3r::ExPolygon->new(Slic3r::Polygon->new(
[25,0], [55,0], [55,30], [25,30], # [25,0], [55,0], [55,30], [25,30],
)); # ));
my $p = $polyline->clone; # my $p = $polyline->clone;
$p->simplify_by_visibility($expolygon); # $p->simplify_by_visibility($expolygon);
is_deeply $p->pp, [ # is_deeply $p->pp, [
map [$_,10], (0,10,20,30,50,60) # map [$_,10], (0,10,20,30,50,60)
], 'simplify_by_visibility()'; # ], 'simplify_by_visibility()';
} # }
{ # {
my $expolygon = Slic3r::ExPolygon->new(Slic3r::Polygon->new( # my $expolygon = Slic3r::ExPolygon->new(Slic3r::Polygon->new(
[-15,0], [75,0], [75,30], [-15,30], # [-15,0], [75,0], [75,30], [-15,30],
)); # ));
my $p = $polyline->clone; # my $p = $polyline->clone;
$p->simplify_by_visibility($expolygon); # $p->simplify_by_visibility($expolygon);
is_deeply $p->pp, [ # is_deeply $p->pp, [
map [$_,10], (0,60) # map [$_,10], (0,60)
], 'simplify_by_visibility()'; # ], 'simplify_by_visibility()';
} # }
{ # {
my $expolygon = Slic3r::ExPolygon->new(Slic3r::Polygon->new( # my $expolygon = Slic3r::ExPolygon->new(Slic3r::Polygon->new(
[-15,0], [25,0], [25,30], [-15,30], # [-15,0], [25,0], [25,30], [-15,30],
)); # ));
my $p = $polyline->clone; # my $p = $polyline->clone;
$p->simplify_by_visibility($expolygon); # $p->simplify_by_visibility($expolygon);
is_deeply $p->pp, [ # is_deeply $p->pp, [
map [$_,10], (0,20,30,40,50,60) # map [$_,10], (0,20,30,40,50,60)
], 'simplify_by_visibility()'; # ], 'simplify_by_visibility()';
} # }
} #}
__END__ __END__

View File

@ -31,8 +31,6 @@
void extend_end(double distance); void extend_end(double distance);
void extend_start(double distance); void extend_start(double distance);
void simplify(double tolerance); void simplify(double tolerance);
void simplify_by_visibility(ExPolygon* expolygon)
%code{% THIS->simplify_by_visibility(*expolygon); %};
void split_at(Point* point, Polyline* p1, Polyline* p2) void split_at(Point* point, Polyline* p1, Polyline* p2)
%code{% THIS->split_at(*point, p1, p2); %}; %code{% THIS->split_at(*point, p1, p2); %};
bool is_straight(); bool is_straight();