MCPcopy Create free account
hub / github.com/comaps/comaps / CommonEdge

Function CommonEdge

generator/tesselator.cpp:122–133  ·  view source on GitHub ↗

Return indexes of common edges of [to, from] triangles.

Source from the content-addressed store, hash-verified

120
121/// Return indexes of common edges of [to, from] triangles.
122std::pair<int, int> CommonEdge(Triangle const & to, Triangle const & from)
123{
124 for (int i = 0; i < 3; ++i)
125 {
126 for (int j = 0; j < 3; ++j)
127 if (to.m_p[i] == from.m_p[math::NextModN(j, 3)] && to.m_p[math::NextModN(i, 3)] == from.m_p[j])
128 return std::make_pair(i, j);
129 }
130
131 ASSERT(false, ("?WTF? Triangles not neighbors!"));
132 return std::make_pair(-1, -1);
133}
134
135/// Get neighbors of 'trg' triangle, which was achieved from 'from' triangle.
136/// @param[out] nb neighbors indexes of 'trg' if 0->1 is common edge with'from':

Callers 2

GetNeighborsMethod · 0.85
CalcDeltaMethod · 0.85

Calls 2

NextModNFunction · 0.85
ASSERTFunction · 0.85

Tested by

no test coverage detected