diff --git a/src/wmtk/invariants/SimplexInversionInvariant.cpp b/src/wmtk/invariants/SimplexInversionInvariant.cpp index 588e457000..abb6e653f7 100644 --- a/src/wmtk/invariants/SimplexInversionInvariant.cpp +++ b/src/wmtk/invariants/SimplexInversionInvariant.cpp @@ -64,7 +64,7 @@ bool SimplexInversionInvariant::after( const Eigen::Vector2 p2 = accessor.const_vector_attribute( mymesh.switch_tuples(ccw_tuple, {PrimitiveType::Edge, PrimitiveType::Vertex})); - if (utils::wmtk_orient2d(p0, p1, p2) <= 0) return false; + if (!is_oriented(p0, p1, p2)) return false; } return true; @@ -78,9 +78,7 @@ bool SimplexInversionInvariant::after( T p1 = accessor.const_scalar_attribute(mymesh.switch_tuple(tuple, PrimitiveType::Vertex)); - // was orient1d(p0,p1) >= 0, whic his equivalent to - // orient1d(p1,p0) - if (is_oriented(p1, p0)) return false; + if (!is_oriented(p0, p1)) return false; } return true; @@ -94,7 +92,7 @@ bool SimplexInversionInvariant::is_oriented( const Eigen::Ref>& p0, const Eigen::Ref>& p1) const { - return is_oriented(p0.x(), p0.x()); + return is_oriented(p0.x(), p1.x()); } template bool SimplexInversionInvariant::is_oriented(const T& p0, const T& p1) const @@ -102,9 +100,9 @@ bool SimplexInversionInvariant::is_oriented(const T& p0, const T& p1) const // const int orient = utils::wmtk_orient1d(p0, p1); if (m_inverted) { - return orient >= 0; + return orient < 0; } else { - return orient <= 0; + return orient > 0; } } template @@ -116,9 +114,9 @@ bool SimplexInversionInvariant::is_oriented( // const int orient = utils::wmtk_orient2d(p0, p1, p2); if (m_inverted) { - return orient >= 0; + return orient < 0; } else { - return orient <= 0; + return orient > 0; } } template @@ -130,9 +128,9 @@ bool SimplexInversionInvariant::is_oriented( { const int orient = utils::wmtk_orient3d(p0, p1, p2, p3); if (m_inverted) { - return orient >= 0; + return orient < 0; } else { - return orient <= 0; + return orient > 0; } // }