MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / edgeConeTest

Method edgeConeTest

tools/MeshUtils/TriangleMetric.cpp:697–727  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

695}
696
697bool TriangleMetric::edgeConeTest(Point& p, int tri_idx) {
698 Point& e1 = m_tris[tri_idx][m_ft_idx[tri_idx]];
699 Point& e2 = m_tris[tri_idx][(m_ft_idx[tri_idx]+1)%3];
700 Point& o = m_tris[tri_idx][(m_ft_idx[tri_idx]+2)%3];
701
702 Vector n1 = e2 - e1;
703 Vector v1 = p - e1;
704 if (n1 * v1 < -epsilon) {
705 m_ft_types[tri_idx] = VERTEX;
706 // no change in m_ft_idx[tri_idx]
707 return false;
708 }
709
710 Vector n2 = e1 - e2;
711 Vector v2 = p - e2;
712 if (n2 * v2 < -epsilon) {
713 m_ft_types[tri_idx] = VERTEX;
714 m_ft_idx[tri_idx] = (m_ft_idx[tri_idx] + 1) % 3;
715 return false;
716 }
717
718 Vector n = (e1 - o) ^ (e2 - o);
719 Vector n3 = n1 ^ n;
720 n3.normalize();
721 if (n3 * v1 < -epsilon) {
722 m_ft_types[tri_idx] = FACE;
723 // no change in m_ft_idx[tri_idx]
724 return false;
725 }
726 return true;
727}
728
729bool TriangleMetric::faceConeTest(Point& p, int tri_idx) {
730 //m_ft_types[tri_idx] = VERTEX;

Callers

nothing calls this directly

Calls 1

normalizeMethod · 0.80

Tested by

no test coverage detected