mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-10-02 12:42:58 +03:00
Cleanup, fix build on windows and add test for rotcalipers. Try to fix compilation on windows With updates from libnest2d Another build fix. Clean up and add comments. adding rotcalipers test and some cleanup Trying to fix on OSX Fix rotcalipers array indexing Get rid of boost convex hull. Adding helper function 'remove_collinear_points' Importing new libnest2d upgrades. Disable using __int128 in NFP on OSX
73 lines
1.6 KiB
C++
73 lines
1.6 KiB
C++
#ifndef CLIPPER_POLYGON_HPP
|
|
#define CLIPPER_POLYGON_HPP
|
|
|
|
#include <clipper.hpp>
|
|
|
|
namespace ClipperLib {
|
|
|
|
struct Polygon {
|
|
Path Contour;
|
|
Paths Holes;
|
|
|
|
inline Polygon() = default;
|
|
|
|
inline explicit Polygon(const Path& cont): Contour(cont) {}
|
|
// inline explicit Polygon(const Paths& holes):
|
|
// Holes(holes) {}
|
|
inline Polygon(const Path& cont, const Paths& holes):
|
|
Contour(cont), Holes(holes) {}
|
|
|
|
inline explicit Polygon(Path&& cont): Contour(std::move(cont)) {}
|
|
// inline explicit Polygon(Paths&& holes): Holes(std::move(holes)) {}
|
|
inline Polygon(Path&& cont, Paths&& holes):
|
|
Contour(std::move(cont)), Holes(std::move(holes)) {}
|
|
};
|
|
|
|
inline IntPoint& operator +=(IntPoint& p, const IntPoint& pa ) {
|
|
// This could be done with SIMD
|
|
p.X += pa.X;
|
|
p.Y += pa.Y;
|
|
return p;
|
|
}
|
|
|
|
inline IntPoint operator+(const IntPoint& p1, const IntPoint& p2) {
|
|
IntPoint ret = p1;
|
|
ret += p2;
|
|
return ret;
|
|
}
|
|
|
|
inline IntPoint& operator -=(IntPoint& p, const IntPoint& pa ) {
|
|
p.X -= pa.X;
|
|
p.Y -= pa.Y;
|
|
return p;
|
|
}
|
|
|
|
inline IntPoint operator -(const IntPoint& p ) {
|
|
IntPoint ret = p;
|
|
ret.X = -ret.X;
|
|
ret.Y = -ret.Y;
|
|
return ret;
|
|
}
|
|
|
|
inline IntPoint operator-(const IntPoint& p1, const IntPoint& p2) {
|
|
IntPoint ret = p1;
|
|
ret -= p2;
|
|
return ret;
|
|
}
|
|
|
|
inline IntPoint& operator *=(IntPoint& p, const IntPoint& pa ) {
|
|
p.X *= pa.X;
|
|
p.Y *= pa.Y;
|
|
return p;
|
|
}
|
|
|
|
inline IntPoint operator*(const IntPoint& p1, const IntPoint& p2) {
|
|
IntPoint ret = p1;
|
|
ret *= p2;
|
|
return ret;
|
|
}
|
|
|
|
}
|
|
|
|
#endif // CLIPPER_POLYGON_HPP
|