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

Method FindStartTriangle

generator/tesselator.cpp:93–119  ·  view source on GitHub ↗

Find best (cheap in serialization) start edge for processing.

Source from the content-addressed store, hash-verified

91
92/// Find best (cheap in serialization) start edge for processing.
93TrianglesInfo::ListInfo::TIterator TrianglesInfo::ListInfo::FindStartTriangle(PointsInfo const & points) const
94{
95 TIterator ret = m_neighbors.end();
96 size_t cr = std::numeric_limits<size_t>::max();
97
98 for (TIterator i = m_neighbors.begin(); i != m_neighbors.end(); ++i)
99 {
100 if (!m_visited[i->second] && m_neighbors.find(std::make_pair(i->first.second, i->first.first)) == m_neighbors.end())
101 {
102 uint64_t deltas[3];
103 deltas[0] = coding::EncodePointDeltaAsUint(points.m_points[i->first.first], points.m_base);
104 deltas[1] = coding::EncodePointDeltaAsUint(points.m_points[i->first.second], points.m_points[i->first.first]);
105 deltas[2] = coding::EncodePointDeltaAsUint(points.m_points[m_triangles[i->second].GetPoint3(i->first)],
106 points.m_points[i->first.second]);
107
108 size_t const sz = GetBufferSize(deltas, deltas + 3);
109 if (sz < cr)
110 {
111 ret = i;
112 cr = sz;
113 }
114 }
115 }
116
117 ASSERT(ret != m_neighbors.end(), ("?WTF? There is no border triangles!"));
118 return ret;
119}
120
121/// Return indexes of common edges of [to, from] triangles.
122std::pair<int, int> CommonEdge(Triangle const & to, Triangle const & from)

Callers 1

ProcessPortionsMethod · 0.80

Calls 7

EncodePointDeltaAsUintFunction · 0.85
GetBufferSizeFunction · 0.85
ASSERTFunction · 0.85
GetPoint3Method · 0.80
endMethod · 0.45
beginMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected