diff options
author | bubnikv <bubnikv@gmail.com> | 2019-10-15 14:49:28 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2019-10-15 14:49:28 +0300 |
commit | c99e7cb0dfac109989f641313255904f493c7153 (patch) | |
tree | fc6ca090b7ddf14a3a9eb84202ee4c151b2a0e9a /src/libslic3r/Point.hpp | |
parent | 67e1eba8e6aa573888d791aab83aa22427377034 (diff) |
Ported test_trianglemesh from upstream slic3r, thanks @lordofhyphens
Diffstat (limited to 'src/libslic3r/Point.hpp')
-rw-r--r-- | src/libslic3r/Point.hpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libslic3r/Point.hpp b/src/libslic3r/Point.hpp index 5f5d86aa8..dced5c02a 100644 --- a/src/libslic3r/Point.hpp +++ b/src/libslic3r/Point.hpp @@ -134,12 +134,30 @@ inline bool is_approx(const Point &p1, const Point &p2, coord_t epsilon = coord_ return d.x() < epsilon && d.y() < epsilon; } +inline bool is_approx(const Vec2f &p1, const Vec2f &p2, float epsilon = float(EPSILON)) +{ + Vec2f d = (p2 - p1).cwiseAbs(); + return d.x() < epsilon && d.y() < epsilon; +} + inline bool is_approx(const Vec2d &p1, const Vec2d &p2, double epsilon = EPSILON) { Vec2d d = (p2 - p1).cwiseAbs(); return d.x() < epsilon && d.y() < epsilon; } +inline bool is_approx(const Vec3f &p1, const Vec3f &p2, float epsilon = float(EPSILON)) +{ + Vec3f d = (p2 - p1).cwiseAbs(); + return d.x() < epsilon && d.y() < epsilon && d.z() < epsilon; +} + +inline bool is_approx(const Vec3d &p1, const Vec3d &p2, double epsilon = EPSILON) +{ + Vec3d d = (p2 - p1).cwiseAbs(); + return d.x() < epsilon && d.y() < epsilon && d.z() < epsilon; +} + namespace int128 { // Exact orientation predicate, // returns +1: CCW, 0: collinear, -1: CW. |