Wildmeshing Toolkit
Loading...
Searching...
No Matches
predicates.hpp
1#pragma once
2
3#include <igl/predicates/predicates.h>
4#include <wmtk/Types.hpp>
5
6namespace wmtk::utils::predicates {
7
11inline bool is_degenerate(const Vector2d& v0, const Vector2d& v1, const Vector2d& v2)
12{
13 return igl::predicates::orient2d(v0, v1, v2) == igl::predicates::Orientation::COLLINEAR;
14}
15
19inline bool is_degenerate(const Vector3d& v0, const Vector3d& v1, const Vector3d& v2)
20{
21 for (int dim = 0; dim < 3; ++dim) {
22 const Vector2d p0(v0[dim], v0[(dim + 1) % 3]);
23 const Vector2d p1(v1[dim], v1[(dim + 1) % 3]);
24 const Vector2d p2(v2[dim], v2[(dim + 1) % 3]);
25
26 if (!is_degenerate(p0, p1, p2)) {
27 return false;
28 }
29 }
30 return true;
31}
32
36inline bool
37is_degenerate(const Vector3d& v0, const Vector3d& v1, const Vector3d& v2, const Vector3d& v3)
38{
39 return igl::predicates::orient3d(v0, v1, v2, v3) == igl::predicates::Orientation::COPLANAR;
40}
41
42} // namespace wmtk::utils::predicates