UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
LocalCartesian.h
Go to the documentation of this file.
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 #ifndef LocalCartesian_H
4 #define LocalCartesian_H
5 
6 /***************************************************************************/
7 /* RSC IDENTIFIER: LOCAL CARTESIAN
8  *
9  * ABSTRACT
10  *
11  * This component provides conversions between Geodetic coordinates (latitude,
12  * longitude in radians and height in meters) and Local Cartesian coordinates
13  * (X, Y, Z).
14  *
15  * ERROR HANDLING
16  *
17  * This component checks parameters for valid values. If an invalid value
18  * is found, the error code is combined with the current error code using
19  * the bitwise or. This combining allows multiple error codes to be
20  * returned. The possible error codes are:
21  *
22  * LOCCART_NO_ERROR : No errors occurred in function
23  * LOCCART_LAT_ERROR : Latitude out of valid range
24  * (-90 to 90 degrees)
25  * LOCCART_LON_ERROR : Longitude out of valid range
26  * (-180 to 360 degrees)
27  * LOCCART_A_ERROR : Semi-major axis less than or equal to zero
28  * LOCCART_INV_F_ERROR : Inverse flattening outside of valid range
29  * (250 to 350)
30  * LOCCART_ORIGIN_LAT_ERROR : Origin Latitude out of valid range
31  * (-90 to 90 degrees)
32  * LOCCART_ORIGIN_LON_ERROR : Origin Longitude out of valid range
33  * (-180 to 360 degrees)
34  * LOCCART_ORIENTATION_ERROR : Orientation angle out of valid range
35  * (-360 to 360 degrees)
36  *
37  *
38  * REUSE NOTES
39  *
40  * LOCCART is intended for reuse by any application that performs
41  * coordinate conversions between geodetic coordinates or geocentric
42  * coordinates and local cartesian coordinates..
43  *
44  *
45  * REFERENCES
46  *
47  * Further information on LOCAL CARTESIAN can be found in the Reuse Manual.
48  *
49  * LOCCART originated from : U.S. Army Topographic Engineering Center
50  * Geospatial Inforamtion Division
51  * 7701 Telegraph Road
52  * Alexandria, VA 22310-3864
53  *
54  * LICENSES
55  *
56  * None apply to this component.
57  *
58  * RESTRICTIONS
59  *
60  * LOCCART has no restrictions.
61  *
62  * ENVIRONMENT
63  *
64  * LOCCART was tested and certified in the following environments:
65  *
66  * 1. Solaris 2.5 with GCC version 2.8.1
67  * 2. Windows 95 with MS Visual C++ version 6
68  *
69  * MODIFICATIONS
70  *
71  * Date Description
72  * ---- -----------
73  * 07-16-99 Original Code
74  * 03-2-07 Original C++ Code
75  *
76  */
77 
78 
79 #include "CoordinateSystem.h"
80 
81 
82 namespace MSP
83 {
84  namespace CCS
85  {
86  class LocalCartesianParameters;
87  class Geocentric;
88 
89 
90  /***************************************************************************/
91  /*
92  * DEFINES
93  */
94 
96  {
97  public:
98 
99  /*
100  * The constructor receives the ellipsoid parameters
101  * and local origin parameters as inputs and sets the corresponding state variables.
102  *
103  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input)
104  * ellipsoidFlattening : Flattening of ellipsoid (input)
105  * originLongitude : Longitude of the local origin, in radians (input)
106  * originLatitude : Latitude of the local origin, in radians (input)
107  * originHeight : Ellipsoid height of the local origin, in meters (input)
108  * orientation : Orientation angle of the local cartesian coordinate system,
109  * in radians (input)
110  */
111 
112  LocalCartesian( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double originLongitude, double originLatitude, double originHeight, double orientation );
113 
114 
115  LocalCartesian( const LocalCartesian &lc );
116 
117 
118  ~LocalCartesian( void );
119 
120 
122 
123 
124  /*
125  * The function getParameters returns the ellipsoid parameters
126  * and local origin parameters.
127  *
128  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output)
129  * ellipsoidFlattening : Flattening of ellipsoid (output)
130  * originLongitude : Longitude of the local origin, in radians (output)
131  * originLatitude : Latitude of the local origin, in radians (output)
132  * originHeight : Ellipsoid height of the local origin, in meters (output)
133  * orientation : Orientation angle of the local cartesian coordinate system,
134  * in radians (output)
135  */
136 
138 
139 
140  /*
141  * The function convertFromGeodetic converts geodetic coordinates
142  * (latitude, longitude, and height) to local cartesian coordinates (X, Y, Z),
143  * according to the current ellipsoid and local origin parameters.
144  *
145  * longitude : Geodetic longitude, in radians (input)
146  * latitude : Geodetic latitude, in radians (input)
147  * Height : Geodetic height, in meters (input)
148  * X : Calculated local cartesian X coordinate, in meters (output)
149  * Y : Calculated local cartesian Y coordinate, in meters (output)
150  * Z : Calculated local cartesian Z coordinate, in meters (output)
151  *
152  */
153 
155 
156 
157  /*
158  * The function convertToGeodetic converts local cartesian
159  * coordinates (X, Y, Z) to geodetic coordinates (latitude, longitude,
160  * and height), according to the current ellipsoid and local origin parameters.
161  *
162  * X : Local cartesian X coordinate, in meters (input)
163  * Y : Local cartesian Y coordinate, in meters (input)
164  * Z : Local cartesian Z coordinate, in meters (input)
165  * longitude : Calculated longitude value, in radians (output)
166  * latitude : Calculated latitude value, in radians (output)
167  * Height : Calculated height value, in meters (output)
168  */
169 
171 
172  /*
173  * The function convertFromGeocentric converts geocentric
174  * coordinates according to the current ellipsoid and local origin parameters.
175  *
176  * U : Geocentric latitude, in meters (input)
177  * V : Geocentric longitude, in meters (input)
178  * W : Geocentric height, in meters (input)
179  * X : Calculated local cartesian X coordinate, in meters (output)
180  * Y : Calculated local cartesian Y coordinate, in meters (output)
181  * Z : Calculated local cartesian Z coordinate, in meters (output)
182  *
183  */
184 
186 
187  /*
188  * The function Convert_Local_Cartesian_To_Geocentric converts local cartesian
189  * coordinates (x, y, z) to geocentric coordinates (X, Y, Z) according to the
190  * current ellipsoid and local origin parameters.
191  *
192  * X : Local cartesian X coordinate, in meters (input)
193  * Y : Local cartesian Y coordinate, in meters (input)
194  * Z : Local cartesian Z coordinate, in meters (input)
195  * U : Calculated U value, in meters (output)
196  * V : Calculated v value, in meters (output)
197  * W : Calculated w value, in meters (output)
198  */
199 
201 
202  private:
203 
204  Geocentric* geocentric;
205 
206  /* Ellipsoid Parameters, default to WGS 84 */
207  double es2; /* Eccentricity (0.08181919084262188000) squared */
208  double u0; /* Geocentric origin coordinates in */
209  double v0; /* terms of Local Cartesian origin */
210  double w0; /* parameters */
211 
212  /* Local Cartesian Projection Parameters */
213  double LocalCart_Origin_Lat; /* Latitude of origin in radians */
214  double LocalCart_Origin_Long; /* Longitude of origin in radians */
215  double LocalCart_Origin_Height; /* Height of origin in meters */
216  double LocalCart_Orientation; /* Orientation of Y axis in radians */
217 
218  double Sin_LocalCart_Origin_Lat; /* sin(LocalCart_Origin_Lat) */
219  double Cos_LocalCart_Origin_Lat; /* cos(LocalCart_Origin_Lat) */
220  double Sin_LocalCart_Origin_Lon; /* sin(LocalCart_Origin_Lon) */
221  double Cos_LocalCart_Origin_Lon; /* cos(LocalCart_Origin_Lon) */
222  double Sin_LocalCart_Orientation; /* sin(LocalCart_Orientation) */
223  double Cos_LocalCart_Orientation; /* cos(LocalCart_Orientation) */
224 
225  double Sin_Lat_Sin_Orient; /* sin(LocalCart_Origin_Lat) * sin(LocalCart_Orientation) */
226  double Sin_Lat_Cos_Orient; /* sin(LocalCart_Origin_Lat) * cos(LocalCart_Orientation) */
227  double Cos_Lat_Cos_Orient; /* cos(LocalCart_Origin_Lat) * cos(LocalCart_Orientation) */
228  double Cos_Lat_Sin_Orient; /* cos(LocalCart_Origin_Lat) * sin(LocalCart_Orientation) */
229 
230  };
231  }
232 }
233 
234 #endif
235 
236 
237 // CLASSIFICATION: UNCLASSIFIED