Ported test_trianglemesh from upstream slic3r, thanks @lordofhyphens

This commit is contained in:
bubnikv 2019-10-15 13:49:28 +02:00
parent 67e1eba8e6
commit c99e7cb0df
7 changed files with 506 additions and 9 deletions

View file

@ -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.