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

Function CalculateLength

libs/coding/coding_tests/traffic_test.cpp:22–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20using std::vector;
21
22double CalculateLength(vector<TrafficGPSEncoder::DataPoint> const & path)
23{
24 double res = 0;
25 for (size_t i = 1; i < path.size(); ++i)
26 {
27 auto p1 = mercator::FromLatLon(path[i - 1].m_latLon.m_lat, path[i - 1].m_latLon.m_lon);
28 auto p2 = mercator::FromLatLon(path[i].m_latLon.m_lat, path[i].m_latLon.m_lon);
29 res += mercator::DistanceOnEarth(p1, p2);
30 }
31 return res;
32}
33
34void Test(vector<TrafficGPSEncoder::DataPoint> & points)
35{

Callers 1

TestFunction · 0.85

Calls 3

FromLatLonFunction · 0.50
DistanceOnEarthFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected