diff --git a/indexer/geometry_coding.cpp b/indexer/geometry_coding.cpp index 7706891521..ea14d863a0 100644 --- a/indexer/geometry_coding.cpp +++ b/indexer/geometry_coding.cpp @@ -60,7 +60,7 @@ m2::PointU PredictPointInTriangle(m2::PointU const & maxPoint, m2::PointU const & p2, m2::PointU const & p3) { - // parallelogramm prediction + // parallelogram prediction return ClampPoint(maxPoint, p1 + p2 - p3); } diff --git a/indexer/geometry_coding.hpp b/indexer/geometry_coding.hpp index 5b3b94aef9..57be2dc774 100644 --- a/indexer/geometry_coding.hpp +++ b/indexer/geometry_coding.hpp @@ -12,8 +12,8 @@ inline uint64_t EncodeDelta(m2::PointU const & actual, m2::PointU const & prediction) { return bits::BitwiseMerge( - bits::ZigZagEncode(static_cast(actual.x) - static_cast(prediction.x)), - bits::ZigZagEncode(static_cast(actual.y) - static_cast(prediction.y))); + bits::ZigZagEncode(static_cast(actual.x) - static_cast(prediction.x)), + bits::ZigZagEncode(static_cast(actual.y) - static_cast(prediction.y))); } inline m2::PointU DecodeDelta(uint64_t delta, m2::PointU const & prediction) @@ -25,18 +25,19 @@ inline m2::PointU DecodeDelta(uint64_t delta, m2::PointU const & prediction) //@} -/// Predict point p0 given previous (p1, p2). +/// Predict next point for polyline with given previous points (p1, p2). m2::PointU PredictPointInPolyline(m2::PointU const & maxPoint, m2::PointU const & p1, m2::PointU const & p2); -/// Predict point p0 given previous (p1, p2, p3). +/// Predict next point for polyline with given previous points (p1, p2, p3). m2::PointU PredictPointInPolyline(m2::PointU const & maxPoint, m2::PointU const & p1, m2::PointU const & p2, m2::PointU const & p3); -/// Predict point p0 given previous (p1, p2, p3). +/// Predict point for neighbour triangle with given +/// previous triangle (p1, p2, p3) and common edge (p1, p2). m2::PointU PredictPointInTriangle(m2::PointU const & maxPoint, m2::PointU const & p1, m2::PointU const & p2, diff --git a/indexer/geometry_serialization.cpp b/indexer/geometry_serialization.cpp index 920a24258b..3a56f7032c 100644 --- a/indexer/geometry_serialization.cpp +++ b/indexer/geometry_serialization.cpp @@ -202,9 +202,9 @@ namespace serial } void DecodeTriangles(geo_coding::InDeltasT const & deltas, - m2::PointU const & basePoint, - m2::PointU const & maxPoint, - geo_coding::OutPointsT & points) + m2::PointU const & basePoint, + m2::PointU const & maxPoint, + geo_coding::OutPointsT & points) { size_t const count = deltas.size(); ASSERT_GREATER ( count, 2, () ); @@ -220,6 +220,8 @@ namespace serial for (size_t i = 3; i < count;) { + // points 0, 1 - is a common edge + // point 2 - is an opposite point for new triangle to calculate prediction size_t trg[3]; if (treeBits & 1) @@ -253,11 +255,11 @@ namespace serial // push points points.push_back(points[trg[0]]); points.push_back(points[trg[1]]); - points.push_back( DecodeDelta(deltas[i] >> 2, - PredictPointInTriangle(maxPoint, - points[trg[0]], - points[trg[1]], - points[trg[2]]))); + points.push_back(DecodeDelta(deltas[i] >> 2, + PredictPointInTriangle(maxPoint, + points[trg[0]], + points[trg[1]], + points[trg[2]]))); // next step treeBits = deltas[i] & 3; diff --git a/indexer/geometry_serialization.hpp b/indexer/geometry_serialization.hpp index 0e4b030879..8a17f6eaa6 100644 --- a/indexer/geometry_serialization.hpp +++ b/indexer/geometry_serialization.hpp @@ -29,12 +29,12 @@ namespace serial /// @name Encode and Decode function types. //@{ - typedef void (*EncodeFunT)( geo_coding::InPointsT const &, - m2::PointU const &, m2::PointU const &, - geo_coding::OutDeltasT &); - typedef void (*DecodeFunT)( geo_coding::InDeltasT const &, - m2::PointU const &, m2::PointU const &, - geo_coding::OutPointsT &); + typedef void (*EncodeFunT)(geo_coding::InPointsT const &, + m2::PointU const &, m2::PointU const &, + geo_coding::OutDeltasT &); + typedef void (*DecodeFunT)(geo_coding::InDeltasT const &, + m2::PointU const &, m2::PointU const &, + geo_coding::OutPointsT &); //@} typedef buffer_vector DeltasT; @@ -196,9 +196,9 @@ namespace serial }; void DecodeTriangles(geo_coding::InDeltasT const & deltas, - m2::PointU const & basePoint, - m2::PointU const & maxPoint, - geo_coding::OutPointsT & triangles); + m2::PointU const & basePoint, + m2::PointU const & maxPoint, + geo_coding::OutPointsT & triangles); template void LoadOuterTriangles(TSource & src, CodingParams const & params, OutPointsT & triangles)