More work on the clipping method for medial axis. Includes Polyline->is_valid()

This commit is contained in:
Alessandro Ranellucci 2013-11-06 19:30:45 +01:00
parent 7e8c535f6a
commit b5aaeb9b12
6 changed files with 38 additions and 3 deletions

View file

@ -49,6 +49,12 @@ MultiPoint::length() const
return len;
}
bool
MultiPoint::is_valid() const
{
return this->points.size() >= 2;
}
#ifdef SLIC3RXS
void
MultiPoint::from_SV(SV* poly_sv)

View file

@ -20,6 +20,7 @@ class MultiPoint
virtual Point* last_point() const = 0;
virtual Lines lines() const = 0;
double length() const;
bool is_valid() const;
#ifdef SLIC3RXS
void from_SV(SV* poly_sv);

View file

@ -40,6 +40,15 @@ Polyline::clip_end(double distance)
}
}
// removes the given distance from the start of the polyline
void
Polyline::clip_start(double distance)
{
this->reverse();
this->clip_end(distance);
if (this->points.size() >= 2) this->reverse();
}
#ifdef SLIC3RXS
SV*
Polyline::to_SV_ref()

View file

@ -11,6 +11,7 @@ class Polyline : public MultiPoint {
Point* last_point() const;
Lines lines() const;
void clip_end(double distance);
void clip_start(double distance);
#ifdef SLIC3RXS
SV* to_SV_ref();