void MakePolygonFromInts(int *ints, int size, ClipperLib::Polygon &p) { p.clear(); p.reserve(size / 2); for (int i = 0; i < size; i +=2) p.push_back(IntPoint(ints[i], ints[i+1])); }
void Slic3rPolygon_to_ClipperPolygon(const Slic3r::Polygon &input, ClipperLib::Polygon &output) { output.clear(); for (Slic3r::Points::const_iterator pit = input.points.begin(); pit != input.points.end(); ++pit) { output.push_back(ClipperLib::IntPoint( (*pit).x, (*pit).y )); } }
void polygonFromQxClipper(const QPolygonF& qxPolygon, ClipperLib::Polygon &clipperPolygon) { clipperPolygon.clear(); clipperPolygon.reserve(qxPolygon.size()); foreach(const QPointF &point, qxPolygon) { clipperPolygon.push_back(ClipperLib::IntPoint(point.x()*ConversionFactor, point.y()*ConversionFactor)); }