From 53c1a905084b2071fb428e1f4a4072f67f602210 Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Wed, 4 Apr 2001 16:08:30 +0000 Subject: rewrote 7 param datum shift to match EPSG:9606, now works with example git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@920 4e78687f-474d-0410-85f9-8d5e500ac6b2 --- ChangeLog | 8 ++++++++ src/pj_transform.c | 50 +++++++++++++++++++++----------------------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index d104c6bd..b7ef1fe5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ +2001-04-04 Frank Warmerdam + + * rewrote 7 param datum shift to match EPSG:9606, now works with + example. + 2001-03-20 Frank Warmerdam + * Added -DPROJ_LIB=\"C:/PROJ/\" in src/makefile.vc to provide for + a default proj data file search directory. + * Added HOWTO-RELEASE document in CVS. 2001-03-15 Frank Warmerdam diff --git a/src/pj_transform.c b/src/pj_transform.c index 9bdd4314..0c665d54 100644 --- a/src/pj_transform.c +++ b/src/pj_transform.c @@ -30,6 +30,9 @@ ****************************************************************************** * * $Log$ + * Revision 1.2 2001/04/04 16:08:08 warmerda + * rewrote 7 param datum shift to match EPSG:9606, now works with example + * * Revision 1.1 2000/07/06 23:32:27 warmerda * New * @@ -48,6 +51,17 @@ #define SRS_WGS84_ESQUARED 0.006694379990 #endif +/* SEC_TO_RAD = Pi/180/3600 */ +#define SEC_TO_RAD 4.84813681109535993589914102357e-6 + +#define Dx_BF (defn->datum_params[0]) +#define Dy_BF (defn->datum_params[1]) +#define Dz_BF (defn->datum_params[2]) +#define Rx_BF (defn->datum_params[3] * SEC_TO_RAD) +#define Ry_BF (defn->datum_params[4] * SEC_TO_RAD) +#define Rz_BF (defn->datum_params[5] * SEC_TO_RAD) +#define M_BF (1 + defn->datum_params[6] * 0.000001) + /************************************************************************/ /* pj_transform() */ /* */ @@ -273,21 +287,10 @@ int pj_geocentric_to_wgs84( PJ *defn, { long io = i * point_offset; double x_out, y_out, z_out; - - x_out = x[io] + defn->datum_params[0] - + y[io] * defn->datum_params[5] - + z[io] * defn->datum_params[4] - + x[io] * defn->datum_params[6]; - y_out = y[io] + defn->datum_params[1] - + x[io] * defn->datum_params[5] - + z[io] * defn->datum_params[3] - + y[io] * defn->datum_params[6]; - - z_out = z[io] + defn->datum_params[2] - + x[io] * defn->datum_params[4] - + y[io] * defn->datum_params[3] - + z[io] * defn->datum_params[6]; + x_out = M_BF*( x[io] - Rz_BF*y[io] + Ry_BF*z[io]) + Dx_BF; + y_out = M_BF*( Rz_BF*x[io] + y[io] - Rx_BF*z[io]) + Dy_BF; + z_out = M_BF*(-Ry_BF*x[io] + Rx_BF*y[io] + z[io]) + Dz_BF; x[io] = x_out; y[io] = y_out; @@ -328,21 +331,10 @@ int pj_geocentric_from_wgs84( PJ *defn, { long io = i * point_offset; double x_out, y_out, z_out; - - x_out = x[io] - defn->datum_params[0] - - y[io] * defn->datum_params[5] - - z[io] * defn->datum_params[4] - - x[io] * defn->datum_params[6]; - - y_out = y[io] - defn->datum_params[1] - - x[io] * defn->datum_params[5] - - z[io] * defn->datum_params[3] - - y[io] * defn->datum_params[6]; - - z_out = z[io] - defn->datum_params[2] - - x[io] * defn->datum_params[4] - - y[io] * defn->datum_params[3] - - z[io] * defn->datum_params[6]; + + x_out = M_BF*( x[io] + Rz_BF*y[io] - Ry_BF*z[io]) - Dx_BF; + y_out = M_BF*(-Rz_BF*x[io] + y[io] + Rx_BF*z[io]) - Dy_BF; + z_out = M_BF*( Ry_BF*x[io] - Rx_BF*y[io] + z[io]) - Dz_BF; x[io] = x_out; y[io] = y_out; -- cgit v1.2.3