Ported contains_line() to XS

This commit is contained in:
Alessandro Ranellucci 2013-11-21 15:12:06 +01:00
parent bd62de7653
commit a225a8b2ef
10 changed files with 97 additions and 67 deletions

View file

@ -1,8 +1,19 @@
#include "ExPolygon.hpp"
#include "Polygon.hpp"
#include "ClipperUtils.hpp"
namespace Slic3r {
ExPolygon::operator Polygons() const
{
Polygons polygons(this->holes.size() + 1);
polygons.push_back(this->contour);
for (Polygons::const_iterator it = this->holes.begin(); it != this->holes.end(); ++it) {
polygons.push_back(*it);
}
return polygons;
}
void
ExPolygon::scale(double factor)
{
@ -50,6 +61,17 @@ ExPolygon::is_valid() const
return true;
}
bool
ExPolygon::contains_line(Line* line) const
{
Polylines pl(1);
pl.push_back(*line);
Polylines pl_out;
diff(pl, *this, pl_out);
return pl_out.empty();
}
#ifdef SLIC3RXS
SV*
ExPolygon::to_AV() {