forked from organicmaps/organicmaps
Added some comments.
This commit is contained in:
parent
13803d5839
commit
d8fb9adaec
4 changed files with 26 additions and 23 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
inline uint64_t EncodeDelta(m2::PointU const & actual, m2::PointU const & prediction)
|
||||
{
|
||||
return bits::BitwiseMerge(
|
||||
bits::ZigZagEncode(static_cast<int32_t>(actual.x) - static_cast<int32_t>(prediction.x)),
|
||||
bits::ZigZagEncode(static_cast<int32_t>(actual.y) - static_cast<int32_t>(prediction.y)));
|
||||
bits::ZigZagEncode(static_cast<int32_t>(actual.x) - static_cast<int32_t>(prediction.x)),
|
||||
bits::ZigZagEncode(static_cast<int32_t>(actual.y) - static_cast<int32_t>(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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<uint64_t, 32> 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 <class TSource>
|
||||
void LoadOuterTriangles(TSource & src, CodingParams const & params, OutPointsT & triangles)
|
||||
|
|
Loading…
Add table
Reference in a new issue