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

Function EncodePolylinePrev3

libs/coding/geometry_coding.cpp:173–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173void EncodePolylinePrev3(InPointsT const & points, m2::PointU const & basePoint, m2::PointU const & maxPoint,
174 OutDeltasT & deltas)
175{
176 ASSERT_LESS_OR_EQUAL(basePoint.x, maxPoint.x, (basePoint, maxPoint));
177 ASSERT_LESS_OR_EQUAL(basePoint.y, maxPoint.y, (basePoint, maxPoint));
178
179 size_t const count = points.size();
180 if (count > 0)
181 {
182 deltas.push_back(EncodePointDeltaAsUint(points[0], basePoint));
183 if (count > 1)
184 {
185 deltas.push_back(EncodePointDeltaAsUint(points[1], points[0]));
186 if (count > 2)
187 {
188 m2::PointD const maxPointD(maxPoint);
189 m2::PointU const prediction = PredictPointInPolyline(maxPointD, points[1], points[0]);
190 deltas.push_back(EncodePointDeltaAsUint(points[2], prediction));
191 for (size_t i = 3; i < count; ++i)
192 {
193 m2::PointU const prediction = PredictPointInPolyline(maxPointD, points[i - 1], points[i - 2], points[i - 3]);
194 deltas.push_back(EncodePointDeltaAsUint(points[i], prediction));
195 }
196 }
197 }
198 }
199
200 ASSERT(TestDecoding(points, basePoint, maxPoint, deltas, &DecodePolylinePrev3), ());
201}
202
203void DecodePolylinePrev3(InDeltasT const & deltas, m2::PointU const & basePoint, m2::PointU const & maxPoint,
204 OutPointsT & points)

Callers

nothing calls this directly

Calls 6

EncodePointDeltaAsUintFunction · 0.85
PredictPointInPolylineFunction · 0.85
ASSERTFunction · 0.85
TestDecodingFunction · 0.85
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected