1 /********************************************************** 2 * Version $Id: loccart.h 911 2011-02-14 16:38:15Z reklov_w $ 3 *********************************************************/ 4 #ifndef LOCCART_H 5 #define LOCCART_H 6 7 /***************************************************************************/ 8 /* RSC IDENTIFIER: LOCAL CARTESIAN 9 * 10 * ABSTRACT 11 * 12 * This component provides conversions between Geodetic coordinates (latitude, 13 * longitude in radians and height in meters) or Geocentric coordinates 14 * (u, v, w) in meters and Local Cartesian coordinates (X, Y, Z). 15 16 * 17 * ERROR HANDLING 18 * 19 * This component checks parameters for valid values. If an invalid value 20 * is found, the error code is combined with the current error code using 21 * the bitwise or. This combining allows multiple error codes to be 22 * returned. The possible error codes are: 23 * 24 * LOCCART_NO_ERROR : No errors occurred in function 25 * LOCCART_LAT_ERROR : Latitude out of valid range 26 * (-90 to 90 degrees) 27 * LOCCART_LON_ERROR : Longitude out of valid range 28 * (-180 to 360 degrees) 29 * LOCCART_A_ERROR : Semi-major axis less than or equal to zero 30 * LOCCART_INV_F_ERROR : Inverse flattening outside of valid range 31 * (250 to 350) 32 * LOCCART_ORIGIN_LAT_ERROR : Origin Latitude out of valid range 33 * (-90 to 90 degrees) 34 * LOCCART_ORIGIN_LON_ERROR : Origin Longitude out of valid range 35 * (-180 to 360 degrees) 36 * LOCCART_ORIENTATION_ERROR : Orientation angle out of valid range 37 * (-360 to 360 degrees) 38 * 39 * 40 * REUSE NOTES 41 * 42 * LOCCART is intended for reuse by any application that performs 43 * coordinate conversions between geodetic coordinates or geocentric 44 * coordinates and local cartesian coordinates.. 45 * 46 * 47 * REFERENCES 48 * 49 * Further information on GEOCENTRIC can be found in the Reuse Manual. 50 * 51 * LOCCART originated from : U.S. Army Topographic Engineering Center 52 * Geospatial Inforamtion Division 53 * 7701 Telegraph Road 54 * Alexandria, VA 22310-3864 55 * 56 * LICENSES 57 * 58 * None apply to this component. 59 * 60 * RESTRICTIONS 61 * 62 * LOCCART has no restrictions. 63 * 64 * ENVIRONMENT 65 * 66 * LOCCART was tested and certified in the following environments: 67 * 68 * 1. Solaris 2.5 with GCC version 2.8.1 69 * 2. Windows 95 with MS Visual C++ version 6 70 * 71 * MODIFICATIONS 72 * 73 * Date Description 74 * ---- ----------- 75 * 76 * 77 */ 78 79 80 /***************************************************************************/ 81 /* 82 * DEFINES 83 */ 84 #define LOCCART_NO_ERROR 0x0000 85 #define LOCCART_LAT_ERROR 0x0001 86 #define LOCCART_LON_ERROR 0x0002 87 #define LOCCART_A_ERROR 0x0004 88 #define LOCCART_INV_F_ERROR 0x0008 89 #define LOCCART_ORIGIN_LAT_ERROR 0x0010 90 #define LOCCART_ORIGIN_LON_ERROR 0x0020 91 #define LOCCART_ORIENTATION_ERROR 0x0040 92 93 94 /***************************************************************************/ 95 /* 96 * FUNCTION PROTOTYPES 97 * for LOCCART.C 98 */ 99 100 /* ensure proper linkage to c++ programs */ 101 #ifdef __cplusplus 102 extern "C" { 103 #endif 104 105 106 long Set_Local_Cartesian_Parameters (double a, 107 double f, 108 double Origin_Latitude, 109 double Origin_Longitude, 110 double Origin_Height, 111 double Orientation); 112 /* 113 * The function Set_Local_Cartesian_Parameters receives the ellipsoid parameters 114 * and local origin parameters as inputs and sets the corresponding state variables. 115 * 116 * a : Semi-major axis of ellipsoid, in meters (input) 117 * f : Flattening of ellipsoid (input) 118 * Origin_Latitude : Latitude of the local origin, in radians (input) 119 * Origin_Longitude : Longitude of the local origin, in radians (input) 120 * Origin_Height : Ellipsoid height of the local origin, in meters (input) 121 * Orientation : Orientation angle of the local cartesian coordinate system, 122 * in radians (input) 123 */ 124 125 126 void Get_Local_Cartesian_Parameters (double *a, 127 double *f, 128 double *Origin_Latitude, 129 double *Origin_Longitude, 130 double *Origin_Height, 131 double *Orientation); 132 /* 133 * The function Get_Local_Cartesian_Parameters returns the ellipsoid parameters 134 * and local origin parameters. 135 * 136 * a : Semi-major axis of ellipsoid, in meters (output) 137 * f : Flattening of ellipsoid (output) 138 * Origin_Latitude : Latitude of the local origin, in radians (output) 139 * Origin_Longitude : Longitude of the local origin, in radians (output) 140 * Origin_Height : Ellipsoid height of the local origin, in meters (output) 141 * Orientation : Orientation angle of the local cartesian coordinate system, 142 * in radians (output) 143 */ 144 145 void Convert_Geocentric_To_Local_Cartesian (double u, 146 double v, 147 double w, 148 double *X, 149 double *Y, 150 double *Z); 151 /* 152 * The function Convert_Geocentric_To_Local_Cartesian converts geocentric 153 * coordinates according to the current ellipsoid and local origin parameters. 154 * 155 * u : Geocentric latitude, in meters (input) 156 * v : Geocentric longitude, in meters (input) 157 * w : Geocentric height, in meters (input) 158 * X : Calculated local cartesian X coordinate, in meters (output) 159 * Y : Calculated local cartesian Y coordinate, in meters (output) 160 * Z : Calculated local cartesian Z coordinate, in meters (output) 161 * 162 */ 163 164 long Convert_Geodetic_To_Local_Cartesian (double Latitude, 165 double Longitude, 166 double Height, 167 double *X, 168 double *Y, 169 double *Z); 170 /* 171 * The function Convert_Geodetic_To_Local_Cartesian converts geodetic coordinates 172 * (latitude, longitude, and height) to local cartesian coordinates (X, Y, Z), 173 * according to the current ellipsoid and local origin parameters. 174 * 175 * Latitude : Geodetic latitude, in radians (input) 176 * Longitude : Geodetic longitude, in radians (input) 177 * Height : Geodetic height, in meters (input) 178 * X : Calculated local cartesian X coordinate, in meters (output) 179 * Y : Calculated local cartesian Y coordinate, in meters (output) 180 * Z : Calculated local cartesian Z coordinate, in meters (output) 181 * 182 */ 183 184 void Convert_Local_Cartesian_To_Geocentric (double X, 185 double Y, 186 double Z, 187 double *u, 188 double *v, 189 double *w); 190 /* 191 * The function Convert_Local_Cartesian_To_Geocentric converts local cartesian 192 * coordinates (x, y, z) to geocentric coordinates (X, Y, Z) according to the 193 * current ellipsoid and local origin parameters. 194 * 195 * X : Local cartesian X coordinate, in meters (input) 196 * Y : Local cartesian Y coordinate, in meters (input) 197 * Z : Local cartesian Z coordinate, in meters (input) 198 * u : Calculated u value, in meters (output) 199 * v : Calculated v value, in meters (output) 200 * w : Calculated w value, in meters (output) 201 */ 202 203 void Convert_Local_Cartesian_To_Geodetic (double X, 204 double Y, 205 double Z, 206 double *Latitude, 207 double *Longitude, 208 double *Height); 209 /* 210 * The function Convert_Local_Cartesian_To_Geodetic converts local cartesian 211 * coordinates (X, Y, Z) to geodetic coordinates (latitude, longitude, 212 * and height), according to the current ellipsoid and local origin parameters. 213 * 214 * X : Local cartesian X coordinate, in meters (input) 215 * Y : Local cartesian Y coordinate, in meters (input) 216 * Z : Local cartesian Z coordinate, in meters (input) 217 * Latitude : Calculated latitude value, in radians (output) 218 * Longitude : Calculated longitude value, in radians (output) 219 * Height : Calculated height value, in meters (output) 220 */ 221 222 223 #ifdef __cplusplus 224 } 225 #endif 226 227 #endif /* LOCCART_H */ 228