libnova v 0.15.0
utility.h
1/*
2 * This library is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2 of the License, or (at your option) any later version.
6 *
7 * This library is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 *
16 * Copyright (C) 2000 - 2005 Liam Girdwood
17 */
18
19#ifndef _LN_UTILITY_H
20#define _LN_UTILITY_H
21
22#include <libnova/ln_types.h>
23
24#ifdef __WIN32__
25#include <time.h>
26// cbrt replacement
27#define cbrt(x) pow (x,1.0/3.0)
28#endif
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
42const char LIBNOVA_EXPORT * ln_get_version (void);
43
53double LIBNOVA_EXPORT ln_get_dec_location(char *s);
54
55
60const char LIBNOVA_EXPORT * ln_get_humanr_location(double location);
61
62/*
63* \fn double ln_get_rect_distance (struct ln_rect_posn * a, struct ln_rect_posn * b)
64* \ingroup misc
65*/
66double LIBNOVA_EXPORT ln_get_rect_distance (struct ln_rect_posn * a, struct ln_rect_posn * b);
67
77double LIBNOVA_EXPORT ln_rad_to_deg (double radians);
78
83double LIBNOVA_EXPORT ln_deg_to_rad (double degrees);
84
89double LIBNOVA_EXPORT ln_hms_to_deg (struct ln_hms * hms);
90
95void LIBNOVA_EXPORT ln_deg_to_hms (double degrees, struct ln_hms * hms);
96
101double LIBNOVA_EXPORT ln_hms_to_rad (struct ln_hms * hms);
102
107void LIBNOVA_EXPORT ln_rad_to_hms (double radians, struct ln_hms * hms);
108
113double LIBNOVA_EXPORT ln_dms_to_deg (struct ln_dms * dms);
114
119void LIBNOVA_EXPORT ln_deg_to_dms (double degrees, struct ln_dms * dms);
120
125double LIBNOVA_EXPORT ln_dms_to_rad (struct ln_dms * dms);
126
131void LIBNOVA_EXPORT ln_rad_to_dms (double radians, struct ln_dms * dms);
132
137void LIBNOVA_EXPORT ln_hequ_to_equ (struct lnh_equ_posn * hpos, struct ln_equ_posn * pos);
138
143void LIBNOVA_EXPORT ln_equ_to_hequ (struct ln_equ_posn * pos, struct lnh_equ_posn * hpos);
144
149void LIBNOVA_EXPORT ln_hhrz_to_hrz (struct lnh_hrz_posn * hpos, struct ln_hrz_posn * pos);
150
155void LIBNOVA_EXPORT ln_hrz_to_hhrz (struct ln_hrz_posn * pos, struct lnh_hrz_posn * hpos);
156
161const char LIBNOVA_EXPORT * ln_hrz_to_nswe (struct ln_hrz_posn * pos);
162
167void LIBNOVA_EXPORT ln_hlnlat_to_lnlat (struct lnh_lnlat_posn * hpos, struct ln_lnlat_posn * pos);
168
173void LIBNOVA_EXPORT ln_lnlat_to_hlnlat (struct ln_lnlat_posn * pos, struct lnh_lnlat_posn * hpos);
174
179void LIBNOVA_EXPORT ln_add_secs_hms (struct ln_hms * hms, double seconds);
180
185void LIBNOVA_EXPORT ln_add_hms (struct ln_hms * source, struct ln_hms * dest);
186
191double LIBNOVA_EXPORT ln_range_degrees (double angle);
192
197double LIBNOVA_EXPORT ln_range_radians (double angle);
198double LIBNOVA_EXPORT ln_range_radians2 (double angle);
199
200/*
201* \fn double ln_get_light_time (double dist)
202* \brief Convert units of AU into light days.
203* \ingroup conversion
204*/
205double LIBNOVA_EXPORT ln_get_light_time (double dist);
206
211double LIBNOVA_EXPORT ln_interpolate3 (double n, double y1, double y2, double y3);
212
217double LIBNOVA_EXPORT ln_interpolate5 (double n, double y1, double y2, double y3, double y4, double y5);
218
219#ifdef __WIN32__
220
221/* Catches calls to the POSIX gmtime_r and converts them to a related WIN32 version. */
222struct tm *gmtime_r (time_t *t, struct tm *gmt);
223
224/* Catches calls to the POSIX gettimeofday and converts them to a related WIN32 version. */
225int gettimeofday(struct timeval *tp, struct timezone *tzp);
226
227/* Catches calls to the POSIX strtok_r and converts them to a related WIN32 version. */
228char *strtok_r(char *str, const char *sep, char **last);
229
230#endif /* __WIN32__ */
231
232/* C89 substitutions for C99 functions. */
233#ifdef __C89_SUB__
234
235/* Simple cube root */
236double cbrt (double x);
237
238#endif /* __C89_SUB__ */
239
240#if defined(__WIN32__) || defined(sun) || defined(__C89_SUB__)
241
242/* Not a Number function generator */
243double nan (const char *code);
244
245#endif /* defined(__WIN32__) || defined(sun) || defined(__C89_SUB__) */
246
247#ifdef __cplusplus
248};
249#endif
250
251#endif
Degrees, minutes and seconds.
Definition ln_types.h:104
Equatorial Coordinates.
Definition ln_types.h:171
Hours, minutes and seconds.
Definition ln_types.h:118
Horizontal Coordinates.
Definition ln_types.h:185
Ecliptical (or celestial) Longitude and Latitude.
Definition ln_types.h:201
Rectangular coordinates.
Definition ln_types.h:238
Right Ascension and Declination.
Definition ln_types.h:131
Azimuth and Altitude.
Definition ln_types.h:143
Ecliptical (or celestial) Latitude and Longitude.
Definition ln_types.h:156