From cd08f83aa5b289f3f822814876fde7810fa9319b Mon Sep 17 00:00:00 2001 From: daveluff Date: Sun, 19 Oct 2003 19:38:01 +0000 Subject: [PATCH] Ug - must have been drunk when committing those two de-align lines! - this one works --- src/ATC/ATCProjection.cxx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/ATC/ATCProjection.cxx b/src/ATC/ATCProjection.cxx index bce25f7f1..4e3f51f89 100644 --- a/src/ATC/ATCProjection.cxx +++ b/src/ATC/ATCProjection.cxx @@ -83,25 +83,24 @@ Point3D FGATCAlignedProjection::ConvertToLocal(Point3D pt) { double delta_lon = pt.lon() - origin.lon(); double y = sin(delta_lat * DCL_DEGREES_TO_RADIANS) * SG_EQUATORIAL_RADIUS_M; double x = sin(delta_lon * DCL_DEGREES_TO_RADIANS) * SG_EQUATORIAL_RADIUS_M * correction_factor; - //cout << "Before alignment, x = " << x << " y = " << y << '\n'; // Align double xbar = x; x = x*cos(theta) - y*sin(theta); y = (xbar*sin(theta)) + (y*cos(theta)); - //cout << "After alignment, x = " << x << " y = " << y << '\n'; return(Point3D(x,y,0.0)); } Point3D FGATCAlignedProjection::ConvertFromLocal(Point3D pt) { - // 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; - + // de-align + double thi = theta * -1.0; + double x = pt.x()*cos(thi) - pt.y()*sin(thi); + double y = (pt.x()*sin(thi)) + (pt.y()*cos(thi)); + + // 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)); } -- 2.39.5