-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathswhsearch.h
305 lines (285 loc) · 9.51 KB
/
swhsearch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
/*
Swephelp
Copyright 2007-2020 Stanislas Marquis <stan@astrorigin.com>
Swephelp is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
Swephelp is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Swephelp. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SWHSEARCH_H
#define SWHSEARCH_H
#ifdef __cplusplus
extern "C"
{
#endif
/** @brief Find next direction changing of object
*
* This function tries to find when and where a planet in direct or
* retrograde motion goes retrograde or direct (respectively).
*
* @remarks Some planets or conditions (flags) wont be treated and the
* function will in those cases return 3.
*
* @remarks If stop is set to 0, the search is not limited in time.
* Otherwise, the function may return 2 when time limit has been reached.
* Flag must include SEFLG_SPEED, and SEFLG_NOGDEFL to avoid bad surprises;
* alternatively use true positions.
*
* @param planet Planet number (SE_*, etc)
* @param jdstart Julian day number, when search is starting
* @param backw Search before jdstart [1], or after [0] (boolean)
* @param stop Limit search to a certain time, expressed in days
* @param flags Calculation flags, see swisseph docs
* @param jdret Julian day number found
* @param posret Planet's positions found
* @param err Buffer for error, declared as char[256]
* @return 0 on success, 1 on error, 2 if limit reached, 3 if argument is invalid
*/
int swh_next_retro(
int planet,
double jdstart,
int backw,
double stop,
int flags,
double* jdret,
double* posret,
char* err);
/** @brief Find next exact aspect to a fixed point
*
* Get Julian day number and positions when a celestial object makes a
* longitudinal aspect to a fixed point expressed in longitude degrees.
*
* @remarks If stop is set to 0, the search is not limited in time.
* Otherwise, the function may return 2 when time limit has been reached.
*
* @param planet Planet number (SE_*, etc)
* @param aspect Aspect, in degrees [0;360[
* @param fixedpt Fixed point targeted [0;360[
* @param jdstart Julian day number, when search is starting
* @param backw Search before jdstart [1], or after [0] (boolean)
* @param stop Limit search to a certain time, expressed in days
* @param flags Calculation flags, see swisseph docs
* @param jdret Julian day number found
* @param posret Planet's positions found
* @param err Buffer for errors, declared as char[256]
* @return 0 on success, 2 if time limit reached, 1 on error
*/
int swh_next_aspect(
int planet,
double aspect,
double fixedpt,
double jdstart,
int backw,
double stop,
int flags,
double* jdret,
double* posret,
char* err);
/** @brief Find next exact aspect to a fixed point
*
* Same as swh_next_aspect but with aspect in [0;180], instead of [0;360[.
*
* @see swh_next_aspect()
*/
int swh_next_aspect2(
int planet,
double aspect,
double fixedpt,
double jdstart,
int backw,
double stop,
int flags,
double* jdret,
double* posret,
char *err);
/** @brief Find next aspect between two moving objects
*
* Get Julian day number and positions when a celestial object makes a
* longitudinal aspect to another moving object.
*
* @remarks If star != NULL, the other planet is ignored.
* If stop is set to 0, the search is not limited in time.
* Otherwise, the function may return 2 when time limit has been reached.
*
* @param planet Planet number (SE_*, etc)
* @param aspect Aspect, in degrees [0;360[
* @param other Other planet number
* @param star Fixed star
* @param jdstart Julian day number, when search is starting
* @param backw Search before jdstart [1], or after [0] (boolean)
* @param stop Limit search to a certain time, expressed in days
* @param flags Calculation flags, see swisseph docs
* @param jdret Julian day number found
* @param posret1 Planet's positions found
* @param posret2 Other planet (or star) positions found
* @param err Buffer for errors, declared as char[256]
* @return 0 on success, 2 if time limit reached, 1 on error
*/
int swh_next_aspect_with(
int planet,
double aspect,
int other,
char* star,
double jdstart,
int backw,
double stop,
int flags,
double* jdret,
double* posret1,
double* posret2,
char* err);
/** @brief Find next aspect between two moving objects
*
* Same as swh_next_aspect_with, but aspect in [0;180], instead of [0;360[.
*
* @see swh_next_aspect_with()
*/
int swh_next_aspect_with2(
int planet,
double aspect,
int other,
char* star,
double jdstart,
int backw,
double stop,
int flags,
double* jdret,
double* posret1,
double* posret2,
char* err);
/** @brief Find next aspect to a house cusp
*
* Get Julian day number and positions, and houses cusps, when a
* celestial object makes longitudinal aspect to a house cusp.
*
* @remarks If star != NULL, the planet is ignored.
*
* @see For risings, settings, meridian transits, see swe_rise_trans.
*
* @param planet Planet number (SE_*, etc)
* @param star Fixed star
* @param aspect Aspect, in degrees [0;360[
* @param cusp House cusp number [1;12], or [1;36] for Gauquelin sectors
* @param jdstart Julian day number, when search is starting
* @param lat Latitude, in degrees (north is positive)
* @param lon Longitude, in degrees (east is positive)
* @param hsys House system, see swisseph docs
* @param backw Search before jdstart [1], or after [0] (boolean)
* @param flags Calculation flags, see swisseph docs
* @param jdret Julian day number found
* @param posret Planet (or fixed star) positions found
* @param cuspsret House cusps positions found
* @param ascmcret Asc-Mc-etc found, see swisseph docs
* @param err Buffer for errors, declared as char[256]
* @return 0 on success, 1 on error
*/
int swh_next_aspect_cusp(
int planet,
char* star,
double aspect,
int cusp,
double jdstart,
double lat,
double lon,
int hsys,
int backw,
int flags,
double* jdret,
double* posret,
double* cuspsret,
double* ascmcret,
char* err);
/** @brief Find next aspect to a house cusp
*
* Same as swh_next_aspect_cusp, but aspect in [0;180], instead of [0;360[.
*
* @see swh_next_aspect_cusp()
*/
int swh_next_aspect_cusp2(
int planet,
char* star,
double aspect,
int cusp,
double jdstart,
double lat,
double lon,
int hsys,
int backw,
int flags,
double* jdret,
double* posret,
double* cuspsret,
double* ascmcret,
char* err);
/** @brief Aspect matching
*
* Check if the two given positions match the aspect within the given orb.
* This also calculates the difference between targeted aspect and distance
* between objects, and if aspect is applicating or separating, or stable due
* to equal speeds.
*
* @param pos0 First object longitude, in degrees [0;360[
* @param speed0 First object longitude speed, in degrees per day
* @param pos1 Second object longitude, in degrees [0;360[
* @param speed1 Second object longitude speed, in degrees per day
* @param aspect Aspect targeted, in degrees [0;360[
* @param orb Orb allowed, in degrees
* @param diffret Difference between aspect and objects distance, in degrees
* @param applic Aspect applicating [-1], separating [1], or stable [0]
* @param factor Aspect strength, compared to orb
* @return 0 if aspect match, else -1
*/
int swh_match_aspect(double pos0, double speed0, double pos1, double speed1,
double aspect, double orb, double *diffret, int *applic, double *factor);
/** @brief Aspect matching
*
* Same as swh_match_aspect, but aspect in [0;180], instead of [0;360[
*
* @see swh_match_aspect()
*/
int swh_match_aspect2(double pos0, double speed0, double pos1, double speed1,
double aspect, double orb, double *diffret, int *applic, double *factor);
/** @brief Aspect matching
*
* Same as swh_match_aspect, but with a different orb in case aspect is
* applying, separating, or stable.
*
* @see swh_match_aspect()
*/
int swh_match_aspect3(double pos0, double speed0, double pos1, double speed1,
double aspect, double app_orb, double sep_orb, double def_orb,
double *diffret, int *applic, double *factor);
/** @brief Aspect matching
*
* Same as swh_match_aspect2, but with a different orb in case aspect is
* applying, separating, or stable.
*
* @see swh_match_aspect2()
*/
int swh_match_aspect4(double pos0, double speed0, double pos1, double speed1,
double aspect, double app_orb, double sep_orb, double def_orb,
double *diffret, int *applic, double *factor);
/** @brief Get number of years difference between two julian days
*
* One exact "astrological" year can be considered as one solar return.
* Then is it varying with the type of zodiac in use.
*
* @param jd1 First Julian day
* @param jd2 Second Julian day
* @param flag Calculation flag
* @param years Result, declared as double
* @param err Buffer for errors, declared as char[256]
* @return 0 on success, else -1
*/
int swh_years_diff(double jd1, double jd2, int flag, double *years, char *err);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* SWHSEARCH_H */
/* vi: set fenc=utf-8 ff=unix et sw=4 ts=4 : */