Find best (cheap in serialization) start edge for processing.
| 91 | |
| 92 | /// Find best (cheap in serialization) start edge for processing. |
| 93 | TrianglesInfo::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. |
| 122 | std::pair<int, int> CommonEdge(Triangle const & to, Triangle const & from) |
no test coverage detected