Ref T390, Ref T372, check for equal coordinates to avoid NaN

This commit is contained in:
Klaus Basan
2018-10-04 17:19:09 +02:00
parent c42900f959
commit 484d89dd85
2 changed files with 12 additions and 1 deletions

View File

@@ -66,9 +66,18 @@ namespace BlackSample
CCoordinateGeodetic geo2(geoVector);
deltaLat = geo2.latitude() - lat;
deltaLng = geo2.longitude() - lng;
out << deltaLat.valueRoundedWithUnit(digits) << " " << deltaLng.valueRoundedWithUnit(digits) << endl;
// Heading/bearing of same values
CAngle bearing = geo.calculateBearing(geo);
CLength distance = geo.calculateGreatCircleDistance(geo);
out << bearing.valueRoundedWithUnit(CAngleUnit::deg(), 2) << " " << distance.valueRoundedWithUnit(CLengthUnit::m(), 2) << endl;
const CCoordinateGeodetic nullCoordinate;
bearing = geo.calculateBearing(nullCoordinate);
distance = geo.calculateGreatCircleDistance(nullCoordinate);
out << bearing.valueRoundedWithUnit(CAngleUnit::deg(), 2) << " " << distance.valueRoundedWithUnit(CLengthUnit::m(), 2) << endl;
// bye
out << "-----------------------------------------------" << endl;
return 0;