2013-07-16 18:09:53 +00:00
|
|
|
#ifndef slic3r_ClipperUtils_hpp_
|
|
|
|
#define slic3r_ClipperUtils_hpp_
|
|
|
|
|
2013-07-16 19:04:14 +00:00
|
|
|
#include <myinit.h>
|
2013-07-16 18:09:53 +00:00
|
|
|
#include "clipper.hpp"
|
2013-07-16 19:04:14 +00:00
|
|
|
#include "ExPolygon.hpp"
|
|
|
|
#include "Polygon.hpp"
|
2013-07-16 18:09:53 +00:00
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------
|
|
|
|
// legacy code from Clipper documentation
|
2013-07-16 19:04:14 +00:00
|
|
|
void AddOuterPolyNodeToExPolygons(ClipperLib::PolyNode& polynode, Slic3r::ExPolygons& expolygons);
|
|
|
|
void PolyTreeToExPolygons(ClipperLib::PolyTree& polytree, Slic3r::ExPolygons& expolygons);
|
2013-07-16 18:09:53 +00:00
|
|
|
//-----------------------------------------------------------
|
|
|
|
|
2013-07-16 19:04:14 +00:00
|
|
|
void Slic3rPolygon_to_ClipperPolygon(Slic3r::Polygon &input, ClipperLib::Polygon &output);
|
|
|
|
void Slic3rPolygons_to_ClipperPolygons(Slic3r::Polygons &input, ClipperLib::Polygons &output);
|
2013-07-16 22:48:29 +00:00
|
|
|
void ClipperPolygon_to_Slic3rPolygon(ClipperLib::Polygon &input, Slic3r::Polygon &output);
|
|
|
|
void ClipperPolygons_to_Slic3rPolygons(ClipperLib::Polygons &input, Slic3r::Polygons &output);
|
2013-07-16 19:04:14 +00:00
|
|
|
void ClipperPolygons_to_Slic3rExPolygons(ClipperLib::Polygons &input, Slic3r::ExPolygons &output);
|
2013-07-16 18:09:53 +00:00
|
|
|
|
2013-07-16 19:04:14 +00:00
|
|
|
void scaleClipperPolygons(ClipperLib::Polygons &polygons, const double scale);
|
2013-07-16 18:09:53 +00:00
|
|
|
|
2013-07-16 22:48:29 +00:00
|
|
|
void offset(Slic3r::Polygons &polygons, ClipperLib::Polygons &retval, const float delta,
|
|
|
|
double scale = 100000, ClipperLib::JoinType joinType = ClipperLib::jtMiter,
|
|
|
|
double miterLimit = 3);
|
|
|
|
void offset(Slic3r::Polygons &polygons, Slic3r::Polygons &retval, const float delta,
|
|
|
|
double scale = 100000, ClipperLib::JoinType joinType = ClipperLib::jtMiter,
|
|
|
|
double miterLimit = 3);
|
2013-07-16 19:04:14 +00:00
|
|
|
void offset_ex(Slic3r::Polygons &polygons, Slic3r::ExPolygons &retval, const float delta,
|
2013-07-16 18:36:27 +00:00
|
|
|
double scale = 100000, ClipperLib::JoinType joinType = ClipperLib::jtMiter,
|
2013-07-16 19:04:14 +00:00
|
|
|
double miterLimit = 3);
|
2013-07-16 18:36:27 +00:00
|
|
|
|
2013-07-16 22:48:29 +00:00
|
|
|
void offset2(Slic3r::Polygons &polygons, ClipperLib::Polygons &retval, const float delta1,
|
|
|
|
const float delta2, double scale = 100000, ClipperLib::JoinType joinType = ClipperLib::jtMiter,
|
|
|
|
double miterLimit = 3);
|
|
|
|
void offset2(Slic3r::Polygons &polygons, Slic3r::Polygons &retval, const float delta1,
|
|
|
|
const float delta2, double scale = 100000, ClipperLib::JoinType joinType = ClipperLib::jtMiter,
|
|
|
|
double miterLimit = 3);
|
2013-07-16 19:04:14 +00:00
|
|
|
void offset2_ex(Slic3r::Polygons &polygons, Slic3r::ExPolygons &retval, const float delta1,
|
2013-07-16 18:36:27 +00:00
|
|
|
const float delta2, double scale = 100000, ClipperLib::JoinType joinType = ClipperLib::jtMiter,
|
2013-07-16 19:04:14 +00:00
|
|
|
double miterLimit = 3);
|
2013-07-16 18:36:27 +00:00
|
|
|
|
2013-07-16 23:21:30 +00:00
|
|
|
template <class T>
|
|
|
|
void _clipper_do(ClipperLib::ClipType clipType, Slic3r::Polygons &subject,
|
|
|
|
Slic3r::Polygons &clip, T &retval, bool safety_offset);
|
|
|
|
void _clipper(ClipperLib::ClipType clipType, Slic3r::Polygons &subject,
|
|
|
|
Slic3r::Polygons &clip, Slic3r::Polygons &retval, bool safety_offset);
|
|
|
|
void _clipper(ClipperLib::ClipType clipType, Slic3r::Polygons &subject,
|
|
|
|
Slic3r::Polygons &clip, Slic3r::ExPolygons &retval, bool safety_offset);
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
void diff(Slic3r::Polygons &subject, Slic3r::Polygons &clip, T &retval, bool safety_offset);
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
void intersection(Slic3r::Polygons &subject, Slic3r::Polygons &clip, T &retval, bool safety_offset);
|
|
|
|
|
2013-07-16 22:29:09 +00:00
|
|
|
void xor_ex(Slic3r::Polygons &subject, Slic3r::Polygons &clip, Slic3r::ExPolygons &retval,
|
|
|
|
bool safety_offset = false);
|
2013-07-16 23:21:30 +00:00
|
|
|
|
2013-07-16 22:29:09 +00:00
|
|
|
void union_ex(Slic3r::Polygons &subject, Slic3r::ExPolygons &retval, bool safety_offset = false);
|
2013-07-16 18:09:53 +00:00
|
|
|
|
2013-08-08 00:10:34 +00:00
|
|
|
void simplify_polygons(Slic3r::Polygons &subject, Slic3r::Polygons &retval);
|
|
|
|
|
2013-07-16 18:09:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|