}
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));
}
/**********************************************************************************/
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));
}
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:
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: