WRAPPER_API bool ComputeInverse(const GeodeticPoint &fromPoint, const GeodeticPoint &toPoint, double &geodesic, double &azimuthAhead, double &azimuthBack) const
The ComputeInverse method computes the shortest path on the Ellipsoid between the two specified points. The shortest path between two points on an Ellipsoid is always the Great Circle that passes through the two points. The first argument to this method is the starting point, and the second argument is the destination point. The third argument gives the calculated geodesic distance between the two points along the Great Circle. The fourth argument gives the azimuth at which the Great Circle intersects the starting point, and the fifth argument gives the azimuth at which the Great Circle intersects the destination point. The method returns a boolean value indicating the success of the operation.
The geodesic distance is given in meters, and the azimuth values are given in radians.
If three-dimensional GeodeticPoints are used with this method, the Height coordinates will be ignored. The Height of the points will be assumed to be 0 so that the calculations will occur on the surface of the Ellipsoid.
void Ellipsoid_ComputeInverse(GEOCALCPBW_NAMESPACE::DataSource & data)
{
GEOCALCPBW_NAMESPACE::Ellipsoid * ell = GEOCALCPBW_NAMESPACE::Ellipsoid::CreateEllipsoid();
GEOCALCPBW_NAMESPACE::LinearValue semiMaj;
semiMaj.set_InMeters(6378137);
ell->set_SemiMajor(semiMaj);
ell->set_InvFlatDefinitive(false);
GEOCALCPBW_NAMESPACE::LinearValue semiMin;
semiMin.set_InMeters(6356752.31424518);
ell->set_SemiMinor(semiMin);
GEOCALCPBW_NAMESPACE::GeodeticPoint * fromPt = data.GetGeodeticPoint(L"BMG", L"GEODETIC_POINT_DEGREES");
GEOCALCPBW_NAMESPACE::GeodeticPoint * toPt = data.GetGeodeticPoint(L"BMG", L"GEODETIC_POINT_DEGREES");
fromPt->set_InUnits(-77.36, 45.45);
toPt->set_InUnits(-77.43, 46.68);
double azimuthAhead;
double azimuthBack;
double geodesic;
if(! ell->ComputeInverse(*fromPt, *toPt, geodesic, azimuthAhead, azimuthBack))
{
AfxMessageBox("ComputeInverse failed");
}
delete ell;
delete fromPt;
delete toPt;
}