mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T390, Ref T372, check for equal coordinates to avoid NaN
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user