Geo Stars Library  0.9.3
Geodetic and Astrometry library
geoStars.h
Go to the documentation of this file.
1 /*!
2 \file geoStars.h
3 <b>rief This file has all of the definitions for the Geo Library:
4  geoEllips, geoAstro, geoPoint, and geoMag.
5 */
6 
7 /*!
8 \mainpage GeoStars Library
9 \author Dean Nelson (DeanNelson at AOL period Com)
10 \version 0.9.2 (08/20/11) Added JavaScript routines that mirror C++ library
11 \version 0.9.1 (07/18/11) Updating all 3rd party packages
12 \version 0.9 (01/10/10) Updated World Magnetic Model to 2010
13 \version 0.8 (02/06/08) Cleanup for final release
14 \version 0.7 Functional Beta (11/26/05) Updates to EFG2LLH Routines
15 \version 0.6 Functional Beta (01/08/05) First SourceForge Release - additional functions for easy Excel integration
16 \version 0.5 Functional Beta (01/08/05) Updated World Magnetic Model to 2005
17 \version 0.4 Functional beta (11/20/04) tuned for DLL and VB support
18 \version 0.3 Functional beta (11/01/03) with geomagnetism routines
19 \version 0.2 Functional beta (02/02/02) with test routines
20 \version 0.1 functional beta (01/28/02)
21 
22 \section Home Home
23 Geodetic Library routines augmented by astrometry routines
24 
25 
26 <b> Table of Contents </b>
27 \li \ref intro
28 \li \ref compile
29 \li \ref formulas
30 \li \ref basic
31 \li \ref cosys
32 \li \ref conv
33 \li \ref mag
34 \li \ref dll
35 \li \ref xls
36 \li \ref how
37 
38 
39 
40 \section intro Introduction
41 This geodetic library has functions for dealing with many geodesy-based problems
42 found in positioning, pointing, and surveying situations. It is useful to determine
43 absolute position on the earth, pointing vectors, coordinate transformations, and
44 deg/min/sec conversions. It has the following features:
45 
46 \li ANSI C code
47 \li Sun position
48 \li Accurate Azimuth, Elevation, and Range calculation
49 \li Cartesian to Polar conversions
50 \li Multiple geocentric to geodetic coordinate conversions
51 \li It has 23 ellipsoid definitions (can be used worldwide)
52 \li Links with the Naval Observatory's Novas library for astronomic calculations
53 \li Calculates the earth's magnetic declination of any location and time(2010-2015)
54 
55 \subsection compile Compiling Instructions
56 Geo Library was designed to be as flexible as possible. It does not come as a linkable
57 library. You compile the code on your command line or place it in your own library.
58 Geo Library contains these files:
59 
60 \li <b> geoStars.h</b> - Main Geo Library include file
61 \li <b> geoEllips.c</b> - Ellipsoid definitions and location descriptor routines
62 \li <b> geoPoint.c</b> - Coordinate transformations, polar and Cartesian conversions
63 \li <b> geoAstro.c</b> - Wrapper routines for the Novas library used in Sun Position
64 \li <b> geoMag.c</b> - Geo Magnetism routines for the World Magnetism Model of 2010
65 \li <b> geoEfg2Llh.c</b> - Geocentric to geodetic conversions (7 different methods)
66 \li <b> geoEfg2Llh_fast.c</b> - Fast and lower accuracy Efg2Llh routines
67 \li <b> NOVAS Library</b> - This is the Naval Observatory Vector Astrometry Subroutine library.
68 
69 Test Code
70 \li <b> geoTest.c</b> - general test routines for the basic geodetic part of the GeoStars Library
71 \li <b> geoMagTest.c</b> - test routines for the World Magnetism Model of 2010 (WMM-2010)
72 \li <b> geoTest.bas</b> - VB test routines for geodetic and WMM-2010 functions
73 \li <b> geoEfg2LlhTest.c</b> - test routines for geocentric to geodetic conversions
74 
75 Novas could be located in a subdirectory called \e novas in the main code tree. When using Novas, you will
76 need to compile in the following files:
77 \li novas.c
78 \li novascon.c
79 \li readeph0.c
80 \li solsys3.c
81 
82 There are also header files in that directory that you may want to make your compiler aware of.
83 Novas source code is not supplied with GeoStars Library. It can be downloaded
84 from http://aa.usno.navy.mil/software/novas/novas_info.html
85 
86 <b> Example compilation with GNU C++</b>
87 
88 with novas already in a library:
89 \code
90 gcc geoTest.c geoAstro.c geoEllips.c geoPoint.c geoMag.c geoEfg2Llh.c novas\novas.a -lm -o geoTest
91 \endcode
92 
93 with Novas not in a library:
94 \code
95 gcc geoTest.c geoAstro.c geoEllips.c geoPoint.c geoMag.c geoEfg2Llh.c \
96  novas\novas.c novas\novascon.c novas\readeph0.c novas\solsys3.c novas/nutation.c -lm -o geoTest
97 \endcode
98 
99 <b> Example compilation with Borland C++</b>
100 
101 with novas already in a library:
102 \code
103 bcc32 geoTest.c geoAstro.c geoEllips.c geoPoint.c geoMag.c geoEfg2Llh.c novas\novas.lib
104 \endcode
105 
106 with Novas not in a library:
107 \code
108 bcc32 geoTest.c geoAstro.c geoEllips.c geoPoint.c geoMag.c geoEfg2Llh.c \
109  novas\novas.c novas\novascon.c novas\readeph0.c novas\solsys3.c
110 \endcode
111 
112 <b> Example compilation with Microsoft C++</b>
113 
114 with novas already in a library:
115 \code
116 cl geoTest.c geoAstro.c geoEllips.c geoPoint.c geoMag.c geoEfg2Llh.c novas\novas.lib
117 \endcode
118 
119 with Novas not in a library:
120 \code
121 cl geoTest.c geoAstro.c geoEllips.c geoPoint.c geoMag.c geoEfg2Llh.c \
122  novas\novas.c novas\novascon.c novas\readeph0.c novas\solsys3.c
123 \endcode
124 
125 
126 <b> Calling the geo.dll from Visual Basic </b>
127 
128 Example:
129 
130 
131 \code
132 Private Declare Function MagD Lib "geoStarsLib.dll" Alias "_geoMagGetDecRet@36" _
133  (ByVal Latitude As Double, ByVal Longitude As Double, ByVal Altitude As Double, _
134  ByVal Month As Integer, ByVal Day As Integer, ByVal Year As Integer) As Double
135 
136 ' Although the path to "geoStarsLib.dll" could be included, if it is in the system path, the local
137 ' directory, c:\windows or \windows\system32, the path is not required, as it will find it in going
138 ' through the defaults.
139 
140 Dim dlat As Double 'Latitude as decimal. Plus for Northern Latitudes
141 Dim dlong As Double 'Longitude as decimal. Minus for West Longitude's
142 Dim alt As Double 'Altitude in Meters An average value for a state can be used
143 Dim mo As Integer 'Month
144 Dim da As Integer 'Day
145 Dim yr As Integer 'Year
146 
147 
148 '_______________________________________________________________
149 Private Sub cmdDeclination_Click() 'They pushed the calculate button'
150 'Note, the following values would normally be generated by some program steps
151 'and checked to be sure they were numeric etc.
152 dlat = 37.1668611
153 dlong = -93.35138889
154 alt = 350
155 mo = 11
156 da = 2
157 yr = 2004
158 
159 txtResult.Text = MagD(dlat, dlong, alt, mo, da, yr) 'The result is displayed in a text box txtResult
160 
161 End Sub
162 '_______________________________________________________________
163 
164 \endcode
165 
166 More examples and definintions are included in <b> geo.bas</b> and <b> geoTest.bas</b>.
167 
168 \htmlonly
169 \ref Home
170 \endhtmlonly
171 
172 
173 \section formulas Formulas
174 \subsection basic Basic Geodesy
175 <b> Ellipsoids</b>
176 
177 Contrary to popular belief, the Earth is not round. It, like most people, is a
178 bit bigger around the girth. That \e girth is called the \e equator. The equator
179 is one of the two axis of the Earth. The other axis is the polar axis.
180 
181 Ellipsoids contain several defining values:
182  \li Major Axis - This is the equatorial axis or radius \f$a\f$
183  \li Minor Axis - This is the polar axis or radius \f$b\f$
184  \li Flattening - This is a ratio describing the amount of flattening that
185  is present on the ellipsoid. Flattening \f$f\f$ is represented by
186  \f[f = \frac{a - b}{a}\f] Flattening is usually a small number
187  (i.e. 0.0033900753) and is often expressed as a fraction
188  (i.e. \f$\frac{1}{297}\f$). \e Inverse \e Flattening \f$f^{-1}\f$ is,
189  of course, the denominator of the fraction.
190  \li Eccentricity - also called Eccentricity Squared \f$e^2\f$ is
191  represented by \f[e^2 = \frac{a^2 - b^2}{a^2}\f]
192  \li Eccentricity Prime - also called Eccentricity Squared Prime \f$e^2_p\f$ is
193  represented by \f[e^2_p = \frac{a^2 - b^2}{b^2}\f]
194 
195 \image html ellipse.gif "Ellipsoid Parameters"
196 \image rtf ellipse.gif "Ellipsoid Parameters"
197 
198 
199 \verbatim
200 The Geo Library contains definitions of the following ellipsoids:
201 
202  Ellipsoid Name, ID, Major Axis, Inverse Flattening
203  ---------------------------------------------------------------------------
204  Airy 1830, AA, 6377563.396, 299.3249646
205  Australian National, AN, 6378160.0 , 298.25
206  Bessel 1841, BR, 6377397.155, 299.1528128
207  Bessel 1841 (Namibia), BN, 6377483.865, 299.1528128
208  Clarke 1866, CC, 6378206.4 , 294.9786982
209  Clarke 1880, CD, 6378249.145, 293.465
210  Everest (Brunei, E. Malaysia ), EB, 6377298.556, 300.8017
211  Everest 1830, EA, 6377276.345, 300.8017
212  Everest 1956 (India and Nepal), EC, 6377301.243, 300.8017
213  Everest (Pakistan), EF, 6377309.613, 300.8017
214  Everest 1948 (W. Malaysia and Singapore), EE, 6377304.063, 300.8017
215  Everest 1969 (W. Malaysia), ED, 6377295.664, 300.8017
216  Geodetic Reference System 1980, RF, 6378137.0 , 298.257222101
217  Helmert 1906, HE, 6378200.0 , 298.3
218  Hough 1960, HO, 6378270.0 , 297.0
219  Indonesian 1974, ID, 6378160.0 , 298.247
220  International 1924, IN, 6378388.0 , 297.0
221  Krassovsky 1940, KA, 6378245.0 , 298.3
222  Modified Airy, AM, 6377340.189, 299.3249646
223  Modified Fischer 1960, FA, 6378155.0 , 298.3
224  South American 1969, SA, 6378160.0 , 298.25
225  WGS 1972, WD, 6378135.0 , 298.26
226  WGS 1984, WE, 6378137.0 , 298.257223563
227  NAD 1983, 83, 6378137.0 ,298.257222101
228 \endverbatim
229 
230 \htmlonly
231 \ref Home
232 \endhtmlonly
233 
234 
235 \subsection cosys Coordinate Systems
236 There are several coordinate systems used in the Geo Library.
237 
238 \li <b> Latitude (\f$\phi\f$), Longitude (\f$\lambda\f$), Height (\f$h\f$)</b>
239 This coordinate system references a point on the Earth's ellipsoid.
240 Latitude and longitude are measured in degrees. Height is measured
241 in meters.
242 
243 \image html latlon2.gif "Latitude, Longitude, and height"
244 
245 \li <b> Earth Fixed Geocentric Coordinates</b>
246 This Cartesian coordinate system uses the center of the earth as a reference point.
247 The coordinates represent an X,Y,Z coordinate system. However, in Geo Library, these
248 coordinates are \e not called X,Y,Z. They are called E,F,G. This is to help
249 distinguish between the tangential plane X,Y,Z coordinate systems.
250 
251 \image html ecefxyz.jpg " Earth Fixed Geocentric Coordinates"
252 
253 \li <b> Range (\f$r\f$), Azimuth (\f$\alpha\f$), Elevation (\f$\epsilon\f$)</b>
254 This polar coordinate system originates from a point on the Earth's ellipsoid.
255 \e Range (\f$r\f$) is measured in meters and represents the slant range from the
256 origin to the point.
257 \e Azimuth (\f$\alpha\f$) is measured clockwise from north (zero degrees) in degrees.
258  \f$\epsilon\f$ is measured from the tangential plane upward. Also in degrees.
259 
260 \image html rae.gif "Range, Azimuth, and Elevation Coordinates"
261 
262 \li <b> X, Y, Z (also known as ENU)</b>
263 This coordinate system also originates at point on the Earth's ellipsoid. \e X
264 (also known as East) is measured in meters from the point eastward. \e Y
265 (also known as North) is measured in meters from the point northward. \e Z
266 (also known as Up) is measured in meters, in the tangential plane,
267  in an upward direction.
268 
269 \image html xyz.gif "X,Y,Z Cartesian Coordinates"
270 
271 \htmlonly
272 \ref Home
273 \endhtmlonly
274 
275 
276 \subsection conv Conversion Formulas
277 
278 \li <b> Range \f$r\f$, Azimuth \f$\alpha\f$, and Elevation \f$\epsilon\f$ to X,Y,Z</b>
279 If the slant range \f$r\f$, azimuth \f$\alpha\f$, and elevation \f$\epsilon\f$
280 from the origin to a point are known, topocentric Cartesian coordinates can
281 be computed in the following manner:
282 
283 \f{eqnarray*}
284 X &=& r \; \cos \, \epsilon \; \sin \, \alpha \\
285 Y &=& r \; \cos \, \epsilon \; \cos \, \alpha \\
286 Z &=& r \; \sin \, \epsilon \\
287  \f}
288 
289 \image html xyz2aer.gif "Conversion of Range, Azimuth, and Elevation to E,F,G Geocentric Coordinates"
290 
291 
292 \li <b> X,Y,Z to Range \f$r\f$, Azimuth \f$\alpha\f$, and Elevation \f$\epsilon\f$</b>
293  If Cartesian coordinates X,Y,Z are known, then slant range \f$r\f$,
294 azimuth \f$\alpha\f$, and elevation \f$\epsilon\f$ can be determined
295 this way:
296 
297  \f{eqnarray*}
298 
299 r &=& \sqrt{X^2 + Y^2 + Z^2} \\
300 
301 
302 \alpha &=& \tan^{-1}\left\{\frac{X}{Y}\right\} \left(if \; \alpha < 0, \; then \; \alpha=\alpha +2\pi \right) \\
303 
304 \epsilon &=& \tan^{-1}\left\{\frac{Z}{ \sqrt{X^2 + Y^2}}\right\} \\
305 
306  \f}
307 
308 
309 \li <b> Latitude \f$\phi\f$, Longitude \f$\lambda\f$, Height \f$h\f$ to E,F,G</b>
310 Geodetic coordinates, Latitude, longitude, and height can be converted to geocentric
311 coordinates through this method:
312 
313  \f{eqnarray*}
314 
315 Radius \; of \; curvature: \; N &=&\frac{a}{\sqrt{1-e^2\sin^2\phi}} \\
316 
317 E &=& \left(N+h\right) \; \cos\phi \; \cos\lambda \\
318 F &=& \left(N+h\right) \; \cos\phi \; \sin\lambda \\
319 G &=& \left[N\left(1-e^2\right)+h\right] \; \sin\phi \\
320  \f}
321 
322 
323 \li <b> E,F,G to Latitude \f$\phi\f$, Longitude \f$\lambda\f$, Height \f$h\f$</b>
324 Geocentric coordinates E,F,G can be converted to
325 latitude \f$\phi\f$, longitude \f$\lambda\f$, and height \f$h\f$. The geoStarsLib has several
326 methods to do this conversion.
327 
328 \subsection iter Iterative Methods available:
329  \li Hirvonen & Moritz method
330  \li Torge method
331  \li Astronomical Almanac 2002 method
332  \li Bowring method
333 
334  \subsection closed Closed Solutions available (non-iterative):
335  \li Borkowski method
336  \li Vermeille method
337  \li geoStarLib method
338 
339 
340 \f[\mathbf{\underline{geoStarsLib \; Method}}\f]
341  \f{eqnarray*}
342 
343 \lambda &=& \tan^{-1}\left\{\frac{F}{E}\right\} \\
344  p &=&\sqrt{E^2+F^2} \\
345  u &=& \tan^{-1}\left\{ \frac{G}{p} \; \frac{a}{b} \right\} \\
346  \phi &=& \tan^{-1} \left\{ \frac{G+e^2_p \; b \; \sin^3u}{p - e^2 \; a \; \cos^3u} \right\} \\
347  u_p &=& \tan^{-1} (( 1-f)\tan \; \phi) \\
348  sign &=& \frac {|p-a \; \cos \; u_p|}{p-a \; \cos \; u_p} \\
349  h &=& sign \sqrt{(p-a \; \cos \; u_p)^2 + (G-b \; \sin \; u_p)^2} \\
350  \f}
351 
352 
353 
354 \f[\mathbf{\underline{Hirvonen \; and \;Moritz \; Method}} \f]
355 
356 \f{eqnarray*}
357  \lambda &=& \tan^{-1} \left\{ \frac{F}{E} \right\} \\
358  p &=& \sqrt{E^2+F^2} \\
359  \phi_1 &=& \tan^{-1} \left\{ \frac{G}{p} \;\; \left(\frac{1}{1-e^2} \right) \right\} \;first \; approximation \\
360  iterate \; &\phi_1& \; until \; the \; \Delta \phi \; is \;insignificant. \\
361  N &=& \frac{a}{\sqrt{1-e^2\sin^2\phi_1}} \\
362  \phi &=& \tan^{-1} \left\{ \frac{G}{p} \left({1 + \frac{e^2 \;N \;\sin(\phi_1)}{G}}\right) \right\} \\
363  \phi_1 &=& \phi \\
364  h &=& \frac{p}{\cos\phi_1}-N \\
365  \f}
366 
367 
368 \f[\mathbf{\underline{Torge \; Method \;/\; Heiskanen \; and \; Moritz \;Method}} \f]
369 \f{eqnarray*}
370  \lambda &=& \tan^{-1} \left\{ \frac{F}{E} \right\} \\
371  p &=& \sqrt{E^2+F^2} \\
372  prepare \; initial \; estimate \; \;
373  \phi_1 &=& \tan^{-1} \left\{\frac{G}{p} \left(\frac{1}{1-e^2}\right)\right\} \\
374  iterate \; &\phi_1& \; until \; the \; \Delta \phi \; is \;insignificant. \\
375  N &=& \frac{a}{\sqrt{1-e^2 \sin^2\phi_1}} \\
376  h &=& \frac{p}{\cos\phi_1}-N \\
377  \phi_1 &=& \tan^{-1} \left\{\frac{G}{p} \left(\frac{1}{1-e^2\frac{N}{N+h}}\right)\right\}\\
378  \phi &=& \phi_1 \\
379 \f}
380 
381 
382 \f[\mathbf{\underline{Astronomical \; Almanac \; 2002 \; Method}} \f]
383 
384 \f{eqnarray*}
385  \lambda &=& \tan^{-1} \left\{ \frac{F}{E} \right\} \\
386  p &=& \sqrt{E^2+F^2} \\
387  prepare \; &initial& \; estimate \; \; \\
388  \phi_1 &=& \tan^{-1} \left\{\frac{G}{p} \right\} \\
389  iterate \; &\phi_1& \; until \; the \; \Delta \phi \; is \;insignificant. \\
390  C &=& \frac{1}{\sqrt{1 - e^2 \sin^2 \phi_1}} \\
391  \phi_1 &=& \tan^{-1} \left\{\frac{G+aCe^2\sin\phi_1}{p}\right\} \\
392 \phi &=& \phi_1 \\
393 
394 \f}
395 
396 
397 \f[\mathbf{\underline{Borkowski \; Method}} \f]
398 
399 \f{eqnarray*}
400  \lambda &=& \tan^{-1} \left\{ \frac{F}{E} \right\} \\
401  r &=& \frac {E}{\cos \lambda} \\
402  e_b &=& \frac{b G - \left( a^2 - b^2\right)}{a r} \\
403  f_b &=& \frac{b G + \left( a^2 - b^2\right)}{a r} \\
404  q &=& 2 \left(e_b^2 - f_b^2) \right) \\
405  p &=& \frac{4}{3} \left(e_b f_b + 1 \right) \\
406  d &=& p^3 + q^2 \\
407  v &=& \sqrt[3]{\sqrt{d} - q} - \sqrt[3]{\sqrt{d} + q} \\
408  g_b &=& \frac{\sqrt{e^2_b + v} + e_b}{2} \\
409  t &=& \sqrt{g_b^2 + \frac{f_b-vg_b}{2g_b-e_b} - g_b} \\
410  \phi &=& \tan^-1\left(\frac{a\left(1-t^2\right)}{2bt} \right) \\
411  h &=& \left(r-at\right)\cos\phi + \left(G-b \right)\sin\phi \\
412 \f}
413 
414 \f[\mathbf{\underline{Vermeille \; Method}} \f]
415 \f{eqnarray*}
416 p &=& \frac{E^2 +F^2}{a2} \\
417 q &=& G^2\frac{1-e^2}{a^2} \\
418 r &=& \frac{p+q-e^4}{6} \\
419 s &=& e^4 \frac{pq}{4r^3} \\
420 t &=& \sqrt[3]{1+s+\sqrt{s\left(2+s\right)}} \\
421 u &=& r\left(1+t+\frac{1}{t} \right) \\
422 v &=& \sqrt{u^2+e^4q} \\
423 w &=& e^2\frac{u+v-q}{2v} \\
424 k &=& \sqrt{u+v+w^2}-w \\
425 D &=& \frac{k\sqrt{E^2 +G^2}}{k+e^2} \\
426 \lambda &=& 2 \;tan^{-1} \frac{F}{E+\sqrt{E^2+F^2}} \\
427 \phi &=& 2 \;tan^{-1} \frac{G}{D+\sqrt{D^2+G^2}} \\
428 h &=& \frac{k+e^2-1}{k}\sqrt{D^2+G^2} \\
429 
430 
431 \f}
432 
433 \subsection mag Geomagnetic Routines
434 The modeling of the earth's magnetic field is called \e geomagnetism. The most current
435 application of this model is magnetic declination - deflection of the compass needle off true north.
436 The earth's magnetic field is in constant motion. Thus, a stable model needed to be developed
437 so that one might be able to correct for the changes of the field in time.
438 
439 By using the geomagnetic routines in this library, true north can be determined quite easily.
440 
441 The geoStarsLib library uses the World Magnetic Model of 2010.
442 
443  The following figure shows the magentic declination in all areas of the world.
444 \image html WMM2010_D_MERC_reduced.png "WMM 2010 declination"
445 \image latex WMM2010_D_MERC_reduced.png "WMM 2010 declination" width=\textwidth
446 
447 Since the magnetic field is always in flux, the WMM2010 discusses the annual rate of change
448 and charts it as follows:
449 
450 \image html WMM2010_D_SV_MERC_reduced.png "WMM 2010 rate of change in declination" width=\textwidth
451 \image latex WMM2010_D_SV_MERC_reduced.png "WMM 2010 rate of change in declination" width=\textwidth
452 
453 \section dll Using Visual Basic and Excel with the geoStarslib DLL
454 geoStarsLib.dll can be used with VB, VBA, and other programs that can access external DLL's. The DLL must
455 be located in the path to be used with Excel. The file \b \e geoTest.bas is an example of how the DLL
456 functions are called from VB. It tests the sun position at the current time.
457 You must make sure that \b \e geo.bas is
458 loaded in your project to provide the interface to the DLL.
459 
460 All of the geoStarsLib routines can be called from Visual Basic using the \e \b Function and
461 \e \b Call methods.
462 
463 Follow this link for more information:
464 \li \ref xls
465 
466 \htmlonly
467 \ref Home
468 \endhtmlonly
469 
470 \section how How do I ....
471 Here are some common questions:
472  -# How do I convert Range, Azimuth, and Elevation to XYZ coordinates?
473  - use geoRae2Xyz() \n\n
474  -# How do I convert XYZ coordinates to Range, Azimuth, and Elevation?
475  - use geoXyz2Rae() \n\n
476  -# How do I get a Range, Azimuth, and Elevation from one point to another and all I have are their geodetic coordinates?
477  - use geoInitLocation() to establish a base location and then again to establish the point location
478  - use geoEfg2XyzDiff() to get the XYZ coordinates of the point (with the base as the origin).
479  - use geoXyz2Rae() to get your polar coordinates \n\n
480  -# How do I get X,Y,Z from one point to another and all I have are their geodetic coordinates?
481  - use geoInitLocation() to establish a base location and then again to establish the point location
482  - use geoEfg2XyzDiff() to get the XYZ coordinates of the point (with the base as the origin). \n\n
483  -# How do I get earth centered coordinates (EFG) from Range, Azimuth, and Elevation?
484  - use geoInitLocation() to establish a base location
485  - use geoRae2Efg() \n\n
486  -# How do I get the Latitude, Longitude and height of the point indicated by Range, Azimuth, and Elevation?
487  - use geoInitLocation() to establish a base location
488  - use geoRae2Efg() to get earth centered coordinates
489  - use geoEfg2Llh() to get Latitude, Longitude, and height. \n\n
490  -# How do I convert radians to degrees, minutes, and seconds?
491  - use geoRads2Dms() \n\n
492  -# How do I convert degrees, minutes, and seconds to radians?
493  - use geoDms2Rads() \n\n
494  -# How do I find out the magnetic declination given a Latitude and Longitude?
495  - use geoMag() to get every blessed geomagnetic variable under the sun, \e or...
496  - use geoMagGetDec() to get just the magnetic declination, \e or ...
497  - use geoMagGetDecRet() to return a double precision value declination (also used in VB) \n\n
498  -# How do I get the position of the sun right now?
499  - use geoInitLocation() to establish a base location
500  - use geoSunAzElNow() to get the Azimuth and Elevation \n\n
501  -# How do I get the sun position for any day?
502  - include time.h
503  - use geoInitLocation() to establish a base location
504  - fill in a tm structure with the date and time you want
505  - use geoSunAzEltm() \n\n
506  -# How do I get the sun position for any day when I only have a Julian date?
507  - use geoInitLocation() to establish a base location
508  - compute or obtain the Julian date/time
509  - use geoSunAzElJD() to get the Azimuth and Elevation \n\n
510  -# How do I get a date with this Julian?
511  - get a life!
512 
513 \htmlonly
514 \ref Home
515 \endhtmlonly
516 */
517 
518 #define GEOSTARSLIB_VERSION 0.9
519 
520 #ifndef GEO_H
521 #define GEO_H
522 
523 #include <time.h>
524 
525 #if defined(GEO_LIB) || !defined(WIN32)
526 #if defined(GEO_LIB)
527 #pragma message( "Compiling geoStarsLib.lib - static")
528 #endif
529 #define DLL_API //!< DLL calling convention
530 #define DLL_CALLCONV //!< DLL calling convention
531 #else
532 #pragma message( "Compiling geoStarsLib.dll - Dynamic")
533 #define WIN32_LEAN_AND_MEAN
534 #define DLL_CALLCONV __stdcall
535 // The following ifdef block is the standard way of creating macros which make exporting
536 // from a DLL simpler. All files within this DLL are compiled with the GEO_EXPORTS
537 // symbol defined on the command line. this symbol should not be defined on any project
538 // that uses this DLL. This way any other project whose source files include this file see
539 // DLL_API functions as being imported from a DLL, wheras this DLL sees symbols
540 // defined with this macro as being exported.
541 #ifdef GEO_EXPORTS
542 #define DLL_API __declspec(dllexport)
543 #else
544 #define DLL_API __declspec(dllimport)
545 #endif // GEO_EXPORTS
546 #endif // GEO_LIB || !WIN32
547 
548 
549 
550 #define GEO_DATUM_DEFAULT 0 //!< Default datum (WGS84)
551 #define GEO_DATUM_AA 1 //!< Datum : Airy 1830
552 #define GEO_DATUM_AN 2 //!< Datum : Australian National
553 #define GEO_DATUM_BR 3 //!< Datum : Bessel 1841
554 #define GEO_DATUM_BN 4 //!< Datum : Bessel 1841 (Namibia)
555 #define GEO_DATUM_CC 5 //!< Datum : Clarke 1866
556 #define GEO_DATUM_CD 6 //!< Datum : Clarke 1880
557 #define GEO_DATUM_EB 7 //!< Datum : Everest (Brunei, E. Malaysia (Sabah and Sarawak))
558 #define GEO_DATUM_EA 8 //!< Datum : Everest 1830
559 #define GEO_DATUM_EC 9 //!< Datum : Everest 1956 (India and Nepal)
560 #define GEO_DATUM_EF 10 //!< Datum : Everest (Pakistan)
561 #define GEO_DATUM_EE 11 //!< Datum : Everest 1948 (W. Malaysia and Singapore)
562 #define GEO_DATUM_ED 12 //!< Datum : Everest 1969 (W. Malaysia)
563 #define GEO_DATUM_RF 13 //!< Datum : Geodetic Reference System 1980 (GRS80)
564 #define GEO_DATUM_HE 14 //!< Datum : Helmert 1906
565 #define GEO_DATUM_HO 15 //!< Datum : Hough 1960
566 #define GEO_DATUM_ID 16 //!< Datum : Indonesian 1974
567 #define GEO_DATUM_IN 17 //!< Datum : International 1924
568 #define GEO_DATUM_KA 18 //!< Datum : Krassovsky 1940
569 #define GEO_DATUM_AM 19 //!< Datum : Modified Airy
570 #define GEO_DATUM_FA 20 //!< Datum : Modified Fischer 1960
571 #define GEO_DATUM_SA 21 //!< Datum : South American 1969
572 #define GEO_DATUM_WD 22 //!< Datum : WGS 1972
573 #define GEO_DATUM_WE 23 //!< Datum : WGS 1984
574 #define GEO_DATUM_83 24 //!< Datum : NAD 1983 (same as GRS80)
575 
576 
577 #define GEO_DATUM_MAX GEO_DATUM_83
578 
579 
580 
581 #define GEO_OK 0 //!< Geo Library return OK
582 #define GEO_ERROR 1 //!< Geo Library return ERROR
583 
584 #ifndef M_PI
585 #define M_PI 3.14159265358979323846 //!< Value of \f$\pi\f$
586 #endif
587 #ifndef TWO_PI
588 #define TWO_PI (2.0*M_PI)
589 #endif
590 
591 #define sqr(n) (n*n) //pow(n,2.0) //!< Squared value: \f$n^2\f$
592 #define cube(n) (n*n*n)//)pow(n,3.0) //!< Cubed value: \f$n^3\f$
593 
594 #define DEG_TO_RAD (M_PI/180.0) //!< Degrees to Radians conversion factor
595 #define RAD_TO_DEG (180.0/M_PI) //!< Radians to Degrees conversion factor
596 #define MIN_TO_DEG (1.0/60.0) //!< Minutes to Degrees conversion factor
597 #define DEG_TO_MIN (60.0) //!< Degrees to Minutes conversion factor
598 #define SEC_TO_DEG (1.0/3600.0) //!< Seconds to Degrees conversion factor
599 #define SIN_1 (sin(SEC_TO_DEG*DEG_TO_RAD))
600 #define CIRCLE (360.0)
601 #define HALF_CIRCLE (CIRCLE / 2.0)
602 #define DELTA_LAT (0.000000001) //!< Delta Lat for EFG2LLH routines
603 
604 //#define EARTH_RADIUS_APPROX 6400000.0
605 
606 #define SOLAR_RADIUS 0.2666 // Solar Semi Diameter as per The Astromicial Almanac 2002, page C24
607 #define SOLAR_DIAMETER (2.0 * SOLAR_SEMIDIAMETER)
608 
609 
610 /*!
611 \def GEO_B(a,f)
612 All geodetic datums and ellipsoids are defined by flattening \f$f\f$ and the
613 major axis \f$a\f$. From these parameters, the other axis and
614 eccentricity can be calculated. \e Minor \e Axis \f$b\f$
615 of the Earth is calculated from the \e Inverse \e Flattening
616 \f$f^{-1}\f$ and the \e Major \e Axis \f$a\f$.
617 
618 Where \f[b={a (1- \frac{1}{f^{-1}})}\f]
619 */
620 
621 /*!
622 \def GEO_FL(f)
623 Since the Geo Library \b ellips structure uses \e inverse \e flattening \f$f^{-1}\f$ then \e flattening
624 can be calculated by
625 \f[\frac{1}{f^{-1}}\f]
626 
627 Duh!
628 */
629 
630 /*!
631 \def GEO_E2(a,f)
632 \e Eccentricity \e Squared \f$e^2\f$ is computed in the following manner:
633 \f[e^2 = \frac{a^2 - b^2}{a^2}\f]
634 */
635 /*!
636 \def GEO_E2P(a,f)
637 \e Eccentricity \e Squared \e Prime \f$e^2_p\f$ is computed in the following manner:
638 \f[e^2_p = \frac{a^2 - b^2}{b^2}\f]
639 */
640 #define GEO_B(a,f) (a*(1.0-(1.0/f)))
641 #define GEO_FL(f) (1.0/f)
642 #define GEO_E2(a,f) (((a*a) - ((GEO_B(a,f))*(GEO_B(a,f))))/(a*a))
643 #define GEO_E2P(a,f) (((a*a) - ((GEO_B(a,f))*(GEO_B(a,f))))/((GEO_B(a,f))*(GEO_B(a,f))))
644 
645 // These are computed at compile time to save CPU in the fast routines
646 #define GEO_WGS84_a (6378137.0)
647 #define GEO_WGS84_b GEO_B(GEO_WGS84_a,298.257223563)
648 #define GEO_WGS84_fl GEO_FL(298.257223563)
649 #define GEO_WGS84_e2 GEO_E2(GEO_WGS84_a,298.257223563)
650 #define GEO_WGS84_ee2 GEO_E2P(GEO_WGS84_a,298.257223563)
651 
652 
653 
654 /* Define indices for 3-element coordinate set arrays: */
655 #define GEO_LAT 0 //!< Latitude
656 #define GEO_LON 1 //!< Longitude
657 #define GEO_HGT 2 //!< Height ( METERS )
658 #define GEO_X 0 //!< X or East coordinate of the local tangential plane ( METERS )
659 #define GEO_Y 1 //!< Y or North coordinate of the local tangential plane ( METERS )
660 #define GEO_Z 2 //!< Z or Up coordinate of the local tangential plane ( METERS )
661 #define GEO_E 0 //!< E coordinate of Earth Fixed Geocentric coordinate ( METERS )
662 #define GEO_F 1 //!< F coordinate of Earth Fixed Geocentric coordinate ( METERS )
663 #define GEO_G 2 //!< G coordinate of Earth Fixed Geocentric coordinate ( METERS )
664 #define GEO_RNG 0 //!< Slant range ( METERS )
665 #define GEO_AZ 1 //!< Azimuth, clockwise from north
666 #define GEO_EL 2 //!< Elevation, from horizon (0) up
667 
668 
669 #define GEO_SZ_ELLIPSOID_NAME 82 //!< Max size of the Ellipsoid name field
670 
671 /* Define accuracy for the Efg2Llh routines */
672 #define GEO_EFG2LLH_MAX_ITS 10 //!< Max iterations allowed in the efg2llh routines
673 #define GEO_EFG2LLH_ACCURACY_METER 0.00001 //!< Use Meter Accuracy in Efg2Llh routines
674 #define GEO_EFG2LLH_ACCURACY_CM 0.0000001 //!< Use Centimeter Accuracy in Efg2Llh routines
675 #define GEO_EFG2LLH_ACCURACY_MM 0.00000001 //!< Use Millimeter Accuracy in Efg2Llh routines
676 #define GEO_EFG2LLH_ACCURACY_MAX 0.0 //!< Use Maximum Accuracy in Efg2Llh routines
677 #define GEO_EFG2LLH_ACCURACY GEO_EFG2LLH_ACCURACY_MM //!< Millimeter accuracy is default
678 
679 extern double geoAccuracy;
680 
681 /*! \struct GEO_ELLIPSOID
682 This defines an earth ellipsoid with the least amount of information.
683 Additional information will be computed from these values
684  */
685 typedef struct
686 {
687  char name[GEO_SZ_ELLIPSOID_NAME]; /*!< Name/title of ellipsoid */
688  char id[4]; /*!< ID designation of the ellipsoid */
689  double a; /*!< Major Earth axis in meters */
690  double f1; /*!< Inverse flattening value */
691 } GEO_ELLIPSOID;
692 
693 /*! \struct GEO_DATUM
694  This structure holds all of the pertinent datum and ellipsoid data associated
695  with particular datum.
696 */
697 typedef struct
698 {
699  int datum_num; /*!< Numeric datum value */
700 
701  /* Ellipsoid values */
702  double a; /*!< Major Earth axis in meters */
703  double b; /*!< Minor Earth axis in meters */
704  double flat; /*!< Earth flattening value */
705  double e2; /*!< Eccentricity squared */
706  double ee2; /*!< Eccentricity squared prime */
707  double m1e2; /*!< 1 - eccentricity squared */
708  double bee2; /*!< b * ee2 */
709  double ae2; /*!< a * e2 */
710  double aob; /*!< a / b */
711 } GEO_DATUM;
712 
713 
714 /*! \struct GEO_LOCATION
715 This structure holds all of the pertinent location,
716 ellipsoid, and datum data associated with a location.
717 */
718 typedef struct
719 {
720  /* Ellipsoid values - this data is now stored in the datum structure */
721  GEO_DATUM datum; /*!< Datum that this location is in. */
722 
723  /* Geodetic coordinates */
724  double lat; /*!< Site Latitude in decimal degrees */
725  double lon; /*!< Site Longitude in decimal degrees */
726  double hgt; /*!< Site Height above the ellipsoid in meters */
727 
728  double rlat; /*!< Radian value of latitude */
729  double rlon; /*!< Radian value of longitude */
730 
731  /* Sine and Cosine values */
732  double slat; /*!< Sine of latitude */
733  double clat; /*!< Cosine of latitude */
734  double slon; /*!< Sine of longitude */
735  double clon; /*!< Cosine of longitude */
736  double tlat; /*!< Tangent of latitude */
737 
738  /* Precomputed values (for speed) */
739  double clonclat; /*!< Cos(lon) * Cos(lat) */
740  double slonslat; /*!< Sin(lon) * Sin(lat) */
741  double clonslat; /*!< Cos(lon) * Sin(lat) */
742  double slonclat; /*!< Sin(lon) * Cos(lat) */
743 
744  double n; /*!< Radius of curvature */
745  double m; /*!< Meridional radius of curvature */
746 
747  /* Geocentric coordinates */
748  double e; /*!< X : Earth Fixed Geocentric (XYZ) Coordinates */
749  double f; /*!< Y : Earth Fixed Geocentric (XYZ) Coordinates */
750  double g; /*!< Z : Earth Fixed Geocentric (XYZ) Coordinates */
751  double efg[3]; /*!< EFG: array of XYZ */
752 
753  /* Geomagentism Related information */
754  /* Caution: this field's value can change daily! (but not by much) */
755  double Declination; /*!< Geomagnetic Declination */
756 
757  double timezone; /*!< Time zone in hours from GMT (i.e Mountain STD time is +7 hours) */
758  int dst; /*!< Daylight Savings Time (1=yes or 0=no) */
759 
760  /* Misc values */
761  // int datum; /*!< Numeric datum value */
762  char name[GEO_SZ_ELLIPSOID_NAME]; /*!< Site Name */
763 } GEO_LOCATION;
764 
765 extern GEO_ELLIPSOID ellips[];
766 extern int geoSunError;
767 
768 
769 
770 /* \struct WMM_DATA
771 This structure contains the WMM-20xx coefficients.
772 */
773 typedef struct
774 {
775  int n; //!< n
776  int m; //!< m
777  double gnm; //!< gnm
778  double hnm; //!< hnm
779  double dgnm; //!< dgnm
780  double dhnm; //!< dhnm
781 } WMM_DATA;
782 
783 
784 /* geo function prototypes */
785 
786 #ifdef __cplusplus
787 extern "C" {
788 #endif
789 
790 #ifndef MAX
791 #define MAX(a,b) ((a>b)?(a):(b))
792 #endif
793 
794 /* geoEllips function */
795 DLL_API void DLL_CALLCONV geoGetEllipsoid(double *a,double *b,double *e2,double *ee2,double *f,int datum);
796 DLL_API int DLL_CALLCONV geoInitDatum(GEO_DATUM* d, int datum);
797 DLL_API int DLL_CALLCONV geoInitLocation(GEO_LOCATION *l, double lat, double lon, double hgt, int datum, char *name);
798 DLL_API int DLL_CALLCONV geoInitLocation2(GEO_LOCATION *l, double lat, double lon, double hgt, const GEO_DATUM* datum, const char *name);
799 DLL_API void DLL_CALLCONV geoSetTimeZone(GEO_LOCATION *l, double tz, int dst);
800 
801 /* geoAstro functions */
802 DLL_API int DLL_CALLCONV geoSunAzElNow(GEO_LOCATION *loc, double *az, double *el);
803 DLL_API int DLL_CALLCONV geoSunAzEltm(GEO_LOCATION *loc, double *az, double *el, struct tm *newtime);
804 DLL_API int DLL_CALLCONV geoSunAzElJD(GEO_LOCATION *loc, double *az, double *el, double tjd_now);
806 DLL_API int DLL_CALLCONV geoGettm(int part);
807 DLL_API double DLL_CALLCONV geoSunNowEl(double lat, double lon, double hgt);
808 DLL_API double DLL_CALLCONV geoSunNowAz(double lat, double lon, double hgt);
809 
810 /* geoPoint functions */
811 DLL_API double DLL_CALLCONV geoVersion(void);
812 
813 DLL_API int DLL_CALLCONV geoEfg2XyzDiff (GEO_LOCATION *src_desc, GEO_LOCATION *tgt_desc, double xyz_disp[]);
814 DLL_API int DLL_CALLCONV geoEfg2XyzDiff_packed(GEO_LOCATION *src_desc, int count, double efg_xyz[]);
815 DLL_API void DLL_CALLCONV geoRae2Efg (GEO_LOCATION *loc, double aer_in[], double efg_out[]);
816 
817 DLL_API void DLL_CALLCONV geoEfg2Llh (int datum, double efg[], double *lat, double *lon, double *hgt);
818 DLL_API void DLL_CALLCONV geoEfg2Llh_packed (const GEO_DATUM* datum, int count, double efg_llh[]);
819 DLL_API double DLL_CALLCONV geoEfg2Lat (int datum, double e, double f, double g);
820 DLL_API double DLL_CALLCONV geoEfg2Lon (int datum, double e, double f, double g);
821 DLL_API double DLL_CALLCONV geoEfg2Hgt (int datum, double e, double f, double g);
822 
823 DLL_API void DLL_CALLCONV geoEfg2Llh_hm (int datum, double efg[], double *lat, double *lon, double *hgt);
824 DLL_API double DLL_CALLCONV geoEfg2Lat_hm (int datum, double e, double f, double g);
825 DLL_API double DLL_CALLCONV geoEfg2Lon_hm (int datum, double e, double f, double g);
826 DLL_API double DLL_CALLCONV geoEfg2Hgt_hm (int datum, double e, double f, double g);
827 DLL_API double DLL_CALLCONV geoEfg2Hgt_hm_its (int datum, double e, double f, double g);
828 
829 DLL_API void DLL_CALLCONV geoEfg2Llh_torge (int datum, double efg[], double *lat, double *lon, double *hgt);
830 DLL_API double DLL_CALLCONV geoEfg2Lat_torge (int datum, double e, double f, double g);
831 DLL_API double DLL_CALLCONV geoEfg2Lon_torge (int datum, double e, double f, double g);
832 DLL_API double DLL_CALLCONV geoEfg2Hgt_torge (int datum, double e, double f, double g);
833 DLL_API double DLL_CALLCONV geoEfg2Hgt_torge_its (int datum, double e, double f, double g);
834 
835 DLL_API void DLL_CALLCONV geoEfg2Llh_bowring (int datum, double efg[], double *lat, double *lon, double *hgt);
836 DLL_API double DLL_CALLCONV geoEfg2Lat_bowring (int datum, double e, double f, double g);
837 DLL_API double DLL_CALLCONV geoEfg2Lon_bowring (int datum, double e, double f, double g);
838 DLL_API double DLL_CALLCONV geoEfg2Hgt_bowring (int datum, double e, double f, double g);
839 DLL_API double DLL_CALLCONV geoEfg2Hgt_bowring_its (int datum, double e, double f, double g);
840 
841 DLL_API void DLL_CALLCONV geoEfg2Llh_aa (int datum, double efg[], double *lat, double *lon, double *hgt);
842 DLL_API double DLL_CALLCONV geoEfg2Lat_aa (int datum, double e, double f, double g);
843 DLL_API double DLL_CALLCONV geoEfg2Lon_aa (int datum, double e, double f, double g);
844 DLL_API double DLL_CALLCONV geoEfg2Hgt_aa (int datum, double e, double f, double g);
845 DLL_API double DLL_CALLCONV geoEfg2Hgt_aa_its (int datum, double e, double f, double g);
846 
847 DLL_API void DLL_CALLCONV geoEfg2Llh_borkowski (int datum, double efg[], double *lat, double *lon, double *hgt);
848 DLL_API double DLL_CALLCONV geoEfg2Lat_borkowski (int datum, double e, double f, double g);
849 DLL_API double DLL_CALLCONV geoEfg2Lon_borkowski (int datum, double e, double f, double g);
850 DLL_API double DLL_CALLCONV geoEfg2Hgt_borkowski (int datum, double e, double f, double g);
851 
852 DLL_API void DLL_CALLCONV geoEfg2Llh_vermeille (int datum, double efg[], double *lat, double *lon, double *hgt);
853 DLL_API double DLL_CALLCONV geoEfg2Lat_vermeille (int datum, double e, double f, double g);
854 DLL_API double DLL_CALLCONV geoEfg2Lon_vermeille (int datum, double e, double f, double g);
855 DLL_API double DLL_CALLCONV geoEfg2Hgt_vermeille (int datum, double e, double f, double g);
856 
857 DLL_API void DLL_CALLCONV geoEfg2Llh_heikkinen (int datum, double efg[], double *lat, double *lon, double *hgt);
858 DLL_API double DLL_CALLCONV geoEfg2Lat_heikkinen (int datum, double e, double f, double g);
859 DLL_API double DLL_CALLCONV geoEfg2Lon_heikkinen (int datum, double e, double f, double g);
860 DLL_API double DLL_CALLCONV geoEfg2Hgt_heikkinen (int datum, double e, double f, double g);
861 
862 DLL_API void DLL_CALLCONV geoEfg2Llh_toms (int datum, double efg[], double *lat, double *lon, double *hgt);
863 DLL_API double DLL_CALLCONV geoEfg2Lat_toms (int datum, double e, double f, double g);
864 DLL_API double DLL_CALLCONV geoEfg2Lon_toms (int datum, double e, double f, double g);
865 DLL_API double DLL_CALLCONV geoEfg2Hgt_toms (int datum, double e, double f, double g);
866 
868 DLL_API int DLL_CALLCONV geoSetAccuracy(double acc);
869 
870 // fast routines
871 DLL_API void DLL_CALLCONV geoEfg2Llh_fast (int datum, double efg[], double *lat, double *lon, double *hgt);
872 DLL_API void DLL_CALLCONV geoEfg2Llh_fast_packed (const GEO_DATUM* datum, int count, double efg_llh[]);
873 DLL_API void DLL_CALLCONV geoEfg2Llh_fast_packed2 (const GEO_DATUM* datum, int count, double efg_in[], double llh_out[]);
874 DLL_API double DLL_CALLCONV geoEfg2Lat_fast (int datum, double e, double f, double g);
875 DLL_API double DLL_CALLCONV geoEfg2Lon_fast (int datum, double e, double f, double g);
876 DLL_API double DLL_CALLCONV geoEfg2Hgt_fast (int datum, double e, double f, double g);
877 
878 DLL_API void DLL_CALLCONV geoEfg2Llh_hm_fast (int datum, double efg[], double *lat, double *lon, double *hgt);
879 DLL_API double DLL_CALLCONV geoEfg2Lat_hm_fast (int datum, double e, double f, double g);
880 DLL_API double DLL_CALLCONV geoEfg2Lon_hm_fast (int datum, double e, double f, double g);
881 DLL_API double DLL_CALLCONV geoEfg2Hgt_hm_fast (int datum, double e, double f, double g);
882 
883 DLL_API void DLL_CALLCONV geoEfg2Llh_torge_fast (int datum, double efg[], double *lat, double *lon, double *hgt);
884 DLL_API double DLL_CALLCONV geoEfg2Lat_torge_fast (int datum, double e, double f, double g);
885 DLL_API double DLL_CALLCONV geoEfg2Lon_torge_fast (int datum, double e, double f, double g);
886 DLL_API double DLL_CALLCONV geoEfg2Hgt_torge_fast (int datum, double e, double f, double g);
887 
888 DLL_API void DLL_CALLCONV geoEfg2Llh_bowring_fast (int datum, double efg[], double *lat, double *lon, double *hgt);
889 DLL_API double DLL_CALLCONV geoEfg2Lat_bowring_fast (int datum, double e, double f, double g);
890 DLL_API double DLL_CALLCONV geoEfg2Lon_bowring_fast (int datum, double e, double f, double g);
891 DLL_API double DLL_CALLCONV geoEfg2Hgt_bowring_fast (int datum, double e, double f, double g);
892 
893 DLL_API void DLL_CALLCONV geoEfg2Llh_aa_fast (int datum, double efg[], double *lat, double *lon, double *hgt);
894 DLL_API double DLL_CALLCONV geoEfg2Lat_aa_fast (int datum, double e, double f, double g);
895 DLL_API double DLL_CALLCONV geoEfg2Lon_aa_fast (int datum, double e, double f, double g);
896 DLL_API double DLL_CALLCONV geoEfg2Hgt_aa_fast (int datum, double e, double f, double g);
897 
898 DLL_API void DLL_CALLCONV geoEfg2Llh_borkowski_fast (int datum, double efg[], double *lat, double *lon, double *hgt);
899 DLL_API double DLL_CALLCONV geoEfg2Lat_borkowski_fast (int datum, double e, double f, double g);
900 DLL_API double DLL_CALLCONV geoEfg2Lon_borkowski_fast (int datum, double e, double f, double g);
901 DLL_API double DLL_CALLCONV geoEfg2Hgt_borkowski_fast (int datum, double e, double f, double g);
902 
903 DLL_API void DLL_CALLCONV geoEfg2Llh_vermeille_fast (int datum, double efg[], double *lat, double *lon, double *hgt);
904 DLL_API double DLL_CALLCONV geoEfg2Lat_vermeille_fast (int datum, double e, double f, double g);
905 DLL_API double DLL_CALLCONV geoEfg2Lon_vermeille_fast (int datum, double e, double f, double g);
906 DLL_API double DLL_CALLCONV geoEfg2Hgt_vermeille_fast (int datum, double e, double f, double g);
907 
908 
909 DLL_API void DLL_CALLCONV geoLlh2Efg (double lat, double lon, double height,int datum, double *e, double *f, double *g);
910 DLL_API void DLL_CALLCONV geoLlh2Efg_packed (GEO_DATUM* datum, int count, double llh_efg[]);
911 DLL_API double DLL_CALLCONV geoLlh2E (double lat, double lon, double height,int datum);
912 DLL_API double DLL_CALLCONV geoLlh2F (double lat, double lon, double height,int datum);
913 DLL_API double DLL_CALLCONV geoLlh2G (double lat, double lon, double height,int datum);
914 DLL_API double DLL_CALLCONV geoLlh2DiffX (double lat1, double lon1, double hgt1,int datum1, double lat2, double lon2, double hgt2,int datum2);
915 DLL_API double DLL_CALLCONV geoLlh2DiffY (double lat1, double lon1, double hgt1,int datum1, double lat2, double lon2, double hgt2,int datum2);
916 DLL_API double DLL_CALLCONV geoLlh2DiffZ (double lat1, double lon1, double hgt1,int datum1, double lat2, double lon2, double hgt2,int datum2);
917 
918 DLL_API void DLL_CALLCONV geoXyz2Rae (double xyz_in[], double rae_out[]);
919 DLL_API void DLL_CALLCONV geoXyz2Rae_packed(int count, double xyz_rae[]);
920 DLL_API double DLL_CALLCONV geoXyz2R (double x, double y, double z);
921 DLL_API double DLL_CALLCONV geoXyz2A (double x, double y, double z);
922 DLL_API double DLL_CALLCONV geoXyz2E (double x, double y, double z);
923 DLL_API void DLL_CALLCONV geoXyz2Efg (GEO_LOCATION *loc, double xyz_in[], double efg_out[]);
924 DLL_API void DLL_CALLCONV geoXyz2Efg_packed(GEO_LOCATION *loc, int size, double xyz_efg[]);
925 
926 
927 DLL_API void DLL_CALLCONV geoRae2Xyz (double rae_in[], double xyz_out[]);
928 DLL_API void DLL_CALLCONV geoRae2Xyz_packed(int size, double rae_xyz[]);
929 DLL_API double DLL_CALLCONV geoRads2Decdms(double rads) ;
930 DLL_API void DLL_CALLCONV geoRads2Dms(double rads,double *deg, double *min, double *sec, double *dir);
931 DLL_API double DLL_CALLCONV geoRads2DD(double rads);
932 DLL_API double DLL_CALLCONV geoDecdms2Rads(double in);
933 DLL_API double DLL_CALLCONV geoDms2DD(double deg, double min, double sec, char *sign);
934 DLL_API double DLL_CALLCONV geoDms2Rads(double deg, double min, double sec, char *sign);
935 DLL_API void DLL_CALLCONV geoDD2Dms(double dd, double *deg, double *min, double *sec, double *dir);
936 DLL_API double DLL_CALLCONV geoDD2Rads(double dd);
937 DLL_API double DLL_CALLCONV geoDD2Deg(double dd);
938 DLL_API double DLL_CALLCONV geoDD2Min(double dd);
939 DLL_API double DLL_CALLCONV geoDD2Sec(double dd);
940 
941 
942 
943 /* geoMag functions */
944 DLL_API int DLL_CALLCONV geomg1( double alt, double glat, double glon, double time,
945  double *dec, double *dip, double *ti, double *gv);
946 
947 DLL_API int DLL_CALLCONV geoMag( double alt, double glat, double glon, double time,
948  double *dec, double *dip, double *ti, double *gv,
949  double *adec,double *adip, double *ati,
950  double *x, double *y, double *z, double *h,
951  double *ax, double *ay, double *az, double *ah);
952 
953 DLL_API int DLL_CALLCONV geoMagGetDec(double lat, double lon, double hgt, int month, int day, int year, double *dec);
954 DLL_API double DLL_CALLCONV geoMagGetDecRet(double lat, double lon, double hgt, int month, int day, int year);
955 DLL_API int DLL_CALLCONV geoMagFillDec(GEO_LOCATION *l, double *dec);
956 DLL_API double DLL_CALLCONV geoMagGetDecNow(double lat, double lon, double hgt);
957 
958 DLL_API int DLL_CALLCONV geoSun(GEO_LOCATION *loc, struct tm *newtime,double *az, double *el);
959 DLL_API int DLL_CALLCONV geoSunM(GEO_LOCATION *loc, struct tm *newtime,double *az, double *el);
960 DLL_API int DLL_CALLCONV geoSunAA(GEO_LOCATION *loc, struct tm *newtime,double *az, double *el);
961 DLL_API int DLL_CALLCONV geoSunPosition(GEO_LOCATION *loc, double *az, double *el);
962 
963 //void geoEfg2Llh(double efg[], double *lat, double *lon, double *hgt);
964 
965 #ifdef __cplusplus
966 }
967 #endif
968 
969 #endif // GEO_H