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

Method GetNeighbors

generator/tesselator.cpp:139–150  ·  view source on GitHub ↗

Get neighbors of 'trg' triangle, which was achieved from 'from' triangle. @param[out] nb neighbors indexes of 'trg' if 0->1 is common edge with'from': - nb[0] - by 1->2 edge; - nb[1] - by 2->0 edge;

Source from the content-addressed store, hash-verified

137/// - nb[0] - by 1->2 edge;
138/// - nb[1] - by 2->0 edge;
139void TrianglesInfo::ListInfo::GetNeighbors(Triangle const & trg, Triangle const & from, int * nb) const
140{
141 int i = math::NextModN(CommonEdge(trg, from).first, 3);
142 int j = math::NextModN(i, 3);
143
144 int ind = 0;
145 TIterator it = m_neighbors.find(std::make_pair(trg.m_p[j], trg.m_p[i]));
146 nb[ind++] = (it != m_neighbors.end()) ? it->second : empty_key;
147
148 it = m_neighbors.find(std::make_pair(trg.m_p[math::NextModN(j, 3)], trg.m_p[j]));
149 nb[ind++] = (it != m_neighbors.end()) ? it->second : empty_key;
150}
151
152/// Calc delta of 'from'->'to' graph edge.
153uint64_t TrianglesInfo::ListInfo::CalcDelta(PointsInfo const & points, Triangle const & from, Triangle const & to) const

Callers

nothing calls this directly

Calls 4

NextModNFunction · 0.85
CommonEdgeFunction · 0.85
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected