Review fix

This commit is contained in:
Sergey Yershov 2015-10-01 11:57:54 +03:00 committed by Sergey Yershov
parent 9b38612867
commit dde61c1ca2
2 changed files with 14 additions and 14 deletions

View file

@ -19,8 +19,8 @@ namespace tesselator
{
int TesselateInterior(PolygonsT const & polys, TrianglesInfo & info)
{
int const kCoordinatesPerVertex = 2;
int const kVerticesInPolygon = 3;
int constexpr kCoordinatesPerVertex = 2;
int constexpr kVerticesInPolygon = 3;
auto const deleter = [](TESStesselator * tess) {tessDeleteTess(tess);};
unique_ptr<TESStesselator, decltype(deleter)> tess(tessNewTess(nullptr), deleter);
@ -89,13 +89,13 @@ int TesselateInterior(PolygonsT const & polys, TrianglesInfo & info)
}
/// Find best (cheap in serialization) start edge for processing.
TrianglesInfo::ListInfo::iter_t
TrianglesInfo::ListInfo::TIterator
TrianglesInfo::ListInfo::FindStartTriangle(PointsInfo const & points) const
{
iter_t ret = m_neighbors.end();
TIterator ret = m_neighbors.end();
size_t cr = numeric_limits<size_t>::max();
for (iter_t i = m_neighbors.begin(); i != m_neighbors.end(); ++i)
for (TIterator i = m_neighbors.begin(); i != m_neighbors.end(); ++i)
{
if (!m_visited[i->second] &&
m_neighbors.find(make_pair(i->first.second, i->first.first)) == m_neighbors.end())
@ -146,7 +146,7 @@ int TesselateInterior(PolygonsT const & polys, TrianglesInfo & info)
int j = my::NextModN(i, 3);
int ind = 0;
iter_t it = m_neighbors.find(make_pair(trg.m_p[j], trg.m_p[i]));
TIterator it = m_neighbors.find(make_pair(trg.m_p[j], trg.m_p[i]));
nb[ind++] = (it != m_neighbors.end()) ? it->second : empty_key;
it = m_neighbors.find(make_pair(trg.m_p[my::NextModN(j, 3)], trg.m_p[j]));
@ -173,7 +173,7 @@ int TesselateInterior(PolygonsT const & polys, TrianglesInfo & info)
template <class TPopOrder>
void TrianglesInfo::ListInfo::MakeTrianglesChainImpl(
PointsInfo const & points, iter_t start, vector<Edge> & chain) const
PointsInfo const & points, TIterator start, vector<Edge> & chain) const
{
chain.clear();
@ -228,7 +228,7 @@ int TesselateInterior(PolygonsT const & polys, TrianglesInfo & info)
};
void TrianglesInfo::ListInfo::MakeTrianglesChain(
PointsInfo const & points, iter_t start, vector<Edge> & chain, bool /*goodOrder*/) const
PointsInfo const & points, TIterator start, vector<Edge> & chain, bool /*goodOrder*/) const
{
//if (goodOrder)
MakeTrianglesChainImpl<edge_greater_delta>(points, start, chain);

View file

@ -72,7 +72,7 @@ namespace tesselator
}
};
typedef unordered_map<pair<int, int>, int, HashPair<int, int>> TNeighbours;
using TNeighbours = unordered_map<pair<int, int>, int, HashPair<int, int>>;
TNeighbours m_neighbors;
void AddNeighbour(int p1, int p2, int trg);
@ -84,7 +84,7 @@ namespace tesselator
PointsInfo const & points, Triangle const & from, Triangle const & to) const;
public:
typedef TNeighbours::const_iterator iter_t;
using TIterator = TNeighbours::const_iterator;
ListInfo(size_t count)
{
@ -105,13 +105,13 @@ namespace tesselator
return (m_visited != test);
}
iter_t FindStartTriangle(PointsInfo const & points) const;
TIterator FindStartTriangle(PointsInfo const & points) const;
private:
template <class TPopOrder>
void MakeTrianglesChainImpl(PointsInfo const & points, iter_t start, vector<Edge> & chain) const;
void MakeTrianglesChainImpl(PointsInfo const & points, TIterator start, vector<Edge> & chain) const;
public:
void MakeTrianglesChain(PointsInfo const & points, iter_t start, vector<Edge> & chain, bool goodOrder) const;
void MakeTrianglesChain(PointsInfo const & points, TIterator start, vector<Edge> & chain, bool goodOrder) const;
size_t GetCount() const { return m_triangles.size(); }
Triangle GetTriangle(size_t i) const { return m_triangles[i]; }
@ -167,7 +167,7 @@ namespace tesselator
do
{
typename ListInfo::iter_t start = i->FindStartTriangle(points);
typename ListInfo::TIterator start = i->FindStartTriangle(points);
i->MakeTrianglesChain(points, start, chain, goodOrder);
m2::PointU arr[] = { points.m_points[start->first.first],