mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-31 00:52:51 +00:00
Moved some math macros (sqr, lerp, clamp) to libslic3r.h
Added UNUSED macro to libslic3r.h, used it to reduce some compile warnings. Split the Int128 class from Clipper library to a separate file, extended Int128 with intrinsic types wherever possible for performance, added new geometric predicates. Added a draft of new FillRectilinear3, which should reduce overfill near the perimeters in the future.
This commit is contained in:
@@ -33,36 +33,6 @@
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
#ifndef clamp
|
||||
template<typename T>
|
||||
static inline T clamp(T low, T high, T x)
|
||||
{
|
||||
return std::max<T>(low, std::min<T>(high, x));
|
||||
}
|
||||
#endif /* clamp */
|
||||
|
||||
#ifndef sqr
|
||||
template<typename T>
|
||||
static inline T sqr(T x)
|
||||
{
|
||||
return x * x;
|
||||
}
|
||||
#endif /* sqr */
|
||||
|
||||
#ifndef mag2
|
||||
static inline coordf_t mag2(const Point &p)
|
||||
{
|
||||
return sqr(coordf_t(p.x)) + sqr(coordf_t(p.y));
|
||||
}
|
||||
#endif /* mag2 */
|
||||
|
||||
#ifndef mag
|
||||
static inline coordf_t mag(const Point &p)
|
||||
{
|
||||
return std::sqrt(mag2(p));
|
||||
}
|
||||
#endif /* mag */
|
||||
|
||||
// Having a segment of a closed polygon, calculate its Euclidian length.
|
||||
// The segment indices seg1 and seg2 signify an end point of an edge in the forward direction of the loop,
|
||||
// therefore the point p1 lies on poly.points[seg1-1], poly.points[seg1] etc.
|
||||
|
||||
Reference in New Issue
Block a user