Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2017-07-27 11:39:43 +0300
committerbubnikv <bubnikv@gmail.com>2017-07-27 11:39:43 +0300
commita6ea01a23f1f4013845fce4ec80c6511b6f40f37 (patch)
tree02bdb4d4146e0da9a8ecb3abfb2bf9c323a79bc2 /xs/src/libslic3r/libslic3r.h
parent3b51f644110978f69edaf95b50a8796e992aab23 (diff)
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.
Diffstat (limited to 'xs/src/libslic3r/libslic3r.h')
-rw-r--r--xs/src/libslic3r/libslic3r.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/xs/src/libslic3r/libslic3r.h b/xs/src/libslic3r/libslic3r.h
index b69d9c564..4a68b030d 100644
--- a/xs/src/libslic3r/libslic3r.h
+++ b/xs/src/libslic3r/libslic3r.h
@@ -88,6 +88,10 @@ inline std::string debug_out_path(const char *name, ...)
#define PRINTF_ZU "%zu"
#endif
+#ifndef UNUSED
+#define UNUSED(x) (void)(x)
+#endif /* UNUSED */
+
// Write slices as SVG images into out directory during the 2D processing of the slices.
// #define SLIC3R_DEBUG_SLICE_PROCESSING
@@ -142,6 +146,25 @@ inline std::unique_ptr<T> make_unique(Args&&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
+template<typename T>
+static inline T sqr(T x)
+{
+ return x * x;
+}
+
+template <typename T>
+static inline T clamp(const T low, const T high, const T value)
+{
+ return std::max(low, std::min(high, value));
+}
+
+template <typename T>
+static inline T lerp(const T a, const T b, const T t)
+{
+ assert(t >= T(-EPSILON) && t <= T(1.+EPSILON));
+ return (1. - t) * a + t * b;
+}
+
} // namespace Slic3r
#endif