ComputeDirect Method

WRAPPER_API bool ComputeDirect(const GeodeticPoint &fromPoint, double geodesic, double azimuth, GeodeticPoint &toPoint) const

 

Description

The ComputeDirect method takes a GeodeticPoint, a geodesic distance, and an azimuth angle as input and produces a GeodeticPoint as output.  The input values occupy the first three arguments of the method and the output point fills the fourth argument.  The method computes a Great Circle that passes through the input point at the specified azimuth.  It then finds the point that lies on the Great Circle the specified distance from the input point in the direction of the specified azimuth.  This point is stored in the GeodeticPoint that occupies the fourth argument to the method.  The method returns a boolean value indicating the success of the operation.

The azimuth value is assumed to be given in radians, and the geodesic distance is assumed to be given in meters.

If a three-dimensional GeodeticPoint is used, this method will ignore the Height coordinate on the input point.  The Height of the point will be assumed to be 0, so that the calculations occur on the surface of the Ellipsoid.  The Height of the output point will be equal to the Height of the input point.

 

Example

void Ellipsoid_ComputeDirect(GEOCALCPBW_NAMESPACE::DataSource & data)

{

GEOCALCPBW_NAMESPACE::Ellipsoid ell;

GEOCALCPBW_NAMESPACE::LinearValue semiMaj;

semiMaj.set_InMeters(6378137);

ell.set_SemiMajor(semiMaj);

ell.set_InvFlatDefinitive(true);

ell.set_InverseFlattening(298.257223563);

 

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);

double azimuth = 1.004;

double geodesic = 1336;

if(! ell.ComputeDirect(*fromPt, geodesic, azimuth, *toPt))

{

AfxMessageBox("ComputeDirect failed");

}

 

delete fromPt;

delete toPt;

}