Implement two convienience functions.
This commit is contained in:
parent
b431775273
commit
6665dcce82
2 changed files with 17 additions and 7 deletions
|
@ -53,7 +53,10 @@ Point3D FGATCProjection::ConvertToLocal(Point3D pt) {
|
|||
}
|
||||
|
||||
Point3D FGATCProjection::ConvertFromLocal(Point3D pt) {
|
||||
return(Point3D(0,0,0));
|
||||
double delta_lat = asin(pt.y() / SG_EQUATORIAL_RADIUS_M) * DCL_RADIANS_TO_DEGREES;
|
||||
double delta_lon = (asin(pt.x() / SG_EQUATORIAL_RADIUS_M) * DCL_RADIANS_TO_DEGREES) / correction_factor;
|
||||
|
||||
return(Point3D(origin.lon()+delta_lon, origin.lat()+delta_lat, 0.0));
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
||||
|
@ -91,7 +94,14 @@ Point3D FGATCAlignedProjection::ConvertToLocal(Point3D pt) {
|
|||
return(Point3D(x,y,0.0));
|
||||
}
|
||||
|
||||
// TODO - IMPLEMENT ME!!!
|
||||
Point3D FGATCAlignedProjection::ConvertFromLocal(Point3D pt) {
|
||||
return(Point3D(0,0,0));
|
||||
// de-align
|
||||
double x = (pt.x() + pt.y()*sin(theta)) / cos(theta);
|
||||
double y = (pt.y() - pt.x()*sin(theta)) / cos(theta);
|
||||
|
||||
// convert from orthogonal to lat/lon
|
||||
double delta_lat = asin(y / SG_EQUATORIAL_RADIUS_M) * DCL_RADIANS_TO_DEGREES;
|
||||
double delta_lon = (asin(x / SG_EQUATORIAL_RADIUS_M) * DCL_RADIANS_TO_DEGREES) / correction_factor;
|
||||
|
||||
return(Point3D(origin.lon()+delta_lon, origin.lat()+delta_lat, 0.0));
|
||||
}
|
||||
|
|
|
@ -32,10 +32,10 @@ public:
|
|||
|
||||
void Init(Point3D centre);
|
||||
|
||||
// Convert a lat/lon co-ordinate to the local projection
|
||||
// Convert a lat/lon co-ordinate (degrees) to the local projection (meters)
|
||||
Point3D ConvertToLocal(Point3D pt);
|
||||
|
||||
// Convert a local projection co-ordinate to lat/lon
|
||||
// Convert a local projection co-ordinate (meters) to lat/lon (degrees)
|
||||
Point3D ConvertFromLocal(Point3D pt);
|
||||
|
||||
private:
|
||||
|
@ -55,10 +55,10 @@ public:
|
|||
|
||||
void Init(Point3D centre, double heading);
|
||||
|
||||
// Convert a lat/lon co-ordinate to the local projection
|
||||
// Convert a lat/lon co-ordinate (degrees) to the local projection (meters)
|
||||
Point3D ConvertToLocal(Point3D pt);
|
||||
|
||||
// Convert a local projection co-ordinate to lat/lon
|
||||
// Convert a local projection co-ordinate (meters) to lat/lon (degrees)
|
||||
Point3D ConvertFromLocal(Point3D pt);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue