swe4r 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +113 -0
  2. data/ext/swe4r/swe4r.c +260 -56
  3. data/lib/swe4r.rb +19 -2
  4. metadata +9 -6
data/README.rdoc ADDED
@@ -0,0 +1,113 @@
1
+ == Swe4r (Swiss Ephemeris for Ruby)
2
+
3
+ The Swe4r rubygem provides a C extension for the standard functions of the {Swiss Ephemeris API}[http://www.astro.com/swisseph/].
4
+
5
+ == Installation
6
+
7
+ Install the gem as usual:
8
+
9
+ [sudo] gem install swe4r
10
+
11
+ == Methods
12
+ The following functions of the {Swiss Ephemeris API}[http://www.astro.com/swisseph/] are supported...
13
+
14
+ {swe_calc_ut}[http://www.astro.com/swisseph/swephprg.htm#_Toc283735419] :: Calculation of planets, moon, asteroids, lunar nodes, apogees, fictitious bodies
15
+ {swe_houses}[http://www.astro.com/swisseph/swephprg.htm#_Toc283735486] :: This function computes house cusps, ascendant, midheaven, etc
16
+ {swe_set_ephe_path}[http://www.astro.com/swisseph/swephprg.htm#_Toc283735481] :: Set directory path of ephemeris files (not required for Moshier Ephemeris)
17
+ {swe_julday}[http://www.astro.com/swisseph/swephprg.htm#_Toc283735468] :: Get the Julian day number from year, month, day, hour
18
+ {swe_set_topo}[http://www.astro.com/swisseph/swephprg.htm#_Toc283735476] :: Set the geographic location for topocentric planet computation
19
+ {swe_set_sid_mode}[http://www.astro.com/swisseph/swephprg.htm#_Toc283735478] :: This function can be used to specify the mode for sidereal computations
20
+ {swe_get_ayanamsa}[http://www.astro.com/swisseph/swephprg.htm#_Toc283735479] :: This function computes the ayanamsha, the distance of the tropical vernal point from the sidereal zero point of the zodiac
21
+
22
+
23
+ == Examples
24
+ The following example demonstrates how to calculate the position of a celestial body such as a planet using the _swe_calc_ut_ function
25
+
26
+ require 'swe4r'
27
+
28
+ # Date Information
29
+ year = 2012
30
+ month = 5
31
+ day = 14
32
+ hour = 10.15
33
+
34
+ # Geographic Location
35
+ longitude = -112.183333
36
+ latitidue = 45.45
37
+ altitude = 1468
38
+
39
+ # Get the Julian day number
40
+ jd = Swe4r::swe_julday(year, month, day, hour)
41
+
42
+ # Set the geographic location for topocentric positions
43
+ Swe4r::swe_set_topo(longitude, latitidue, altitude)
44
+
45
+ # Set the sidereal mode for sidereal positions
46
+ Swe4r::swe_set_sid_mode(Swe4r::SE_SIDM_LAHIRI, 0, 0)
47
+
48
+ # Get the ayanamsha (the distance of the tropical vernal point from the sidereal zero point of the zodiac)
49
+ ayanamsha = Swe4r::swe_get_ayanamsa_ut(jd)
50
+
51
+ # Calculate the position of the Sun
52
+ # Use the Moshier Ephemeris (does not require ephemeris files)
53
+ # Get high precision speed and sidereal/topocentric positions
54
+ body = Swe4r::swe_calc_ut(jd, Swe4r::SE_SUN, Swe4r::SEFLG_MOSEPH|Swe4r::SEFLG_SPEED|Swe4r::SEFLG_TOPOCTR|Swe4r::SEFLG_SIDEREAL)
55
+
56
+ # Print the results
57
+ puts "Longitude: #{body[0]}"
58
+ puts "Latitude: #{body[1]}"
59
+ puts "Distance in AU: #{body[2]}"
60
+ puts "Speed in longitude (deg/day): #{body[3]}"
61
+ puts "Speed in latitude (deg/day): #{body[4]}"
62
+ puts "Speed in distance (AU/day): #{body[5]}"
63
+ puts "Ayanamsha: #{ayanamsha}"
64
+
65
+ The following example demonstrates how to calculate house cusps, the ascendant, midheaven, and other points on the zodiac using the _swe_houses_ function
66
+
67
+ require 'swe4r'
68
+
69
+
70
+ # Date Information
71
+ year = 2012
72
+ month = 5
73
+ day = 14
74
+ hour = 10.15
75
+
76
+ # Geographic Location
77
+ longitude = -112.183333
78
+ latitidue = 45.45
79
+ altitude = 1468
80
+
81
+ # Get the Julian day number
82
+ jd = Swe4r::swe_julday(year, month, day, hour)
83
+
84
+ # Get house details using the Placidus house system
85
+ houses = Swe4r::swe_houses(jd, latitidue, longitude, 'P')
86
+
87
+ # Print the house cusps
88
+ (1..12).each do |i|
89
+ puts "House ##{i} Cusp: #{houses[i]}"
90
+ end
91
+
92
+ # Print ascendant, midheaven, etc
93
+ puts "Ascendant: #{houses[13]}"
94
+ puts "Midheaven (MC): #{houses[14]}"
95
+ puts "ARMC: #{houses[15]}"
96
+ puts "Equatorial Ascendant: #{houses[16]}"
97
+ puts "Co-Ascendant (Walter Koch): #{houses[17]}"
98
+ puts "Co-Ascendant (Michael Munkasey): #{houses[18]}"
99
+ puts "Polar Ascendant (M. Munkasey) : #{houses[19]}"
100
+
101
+ == License
102
+ Swe4r is free software: you can redistribute it and/or modify
103
+ it under the terms of the GNU General Public License as published by
104
+ the Free Software Foundation, either version 3 of the License, or
105
+ (at your option) any later version.
106
+
107
+ Swe4r is distributed in the hope that it will be useful,
108
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
109
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
110
+ GNU General Public License for more details.
111
+
112
+ You should have received a copy of the GNU General Public License
113
+ along with Swe4r. If not, see {http://www.gnu.org/licenses/}[http://www.gnu.org/licenses/].
data/ext/swe4r/swe4r.c CHANGED
@@ -1,51 +1,163 @@
1
+ /*
2
+ Swe4r :: Swiss Ephemeris for Ruby - A C extension for the Swiss Ephemeris library (http://www.astro.com/swisseph/)
3
+ Copyright (C) 2012 Andrew Kirk (andrew.kirk@windhorsemedia.com)
4
+
5
+ This file is part of Swe4r.
6
+
7
+ Swe4r is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ Swe4r is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with Swe4r. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+
22
+
1
23
  #include "ruby.h"
2
24
  #include "swephexp.h"
3
25
 
4
- // Module
26
+ // Module Name
5
27
  VALUE rb_mSwe4r = Qnil;
6
28
 
7
- // Set directory path of ephemeris files
8
- // int swe_set_ephe_path(char *path);
29
+ /*
30
+ * Body numbers used by the swe_calc_ut() method
31
+ * See http://www.astro.com/swisseph/swephprg.htm#_Toc283735422
32
+ */
33
+ #define SE_SUN 0 /* Sun */
34
+ #define SE_MOON 1 /* Moon */
35
+ #define SE_MERCURY 2 /* Mercury */
36
+ #define SE_VENUS 3 /* Venus */
37
+ #define SE_MARS 4 /* Mars */
38
+ #define SE_JUPITER 5 /* Jupiter */
39
+ #define SE_SATURN 6 /* Saturn */
40
+ #define SE_URANUS 7 /* Uranus */
41
+ #define SE_NEPTUNE 8 /* Neptune */
42
+ #define SE_PLUTO 9 /* Pluto */
43
+ #define SE_MEAN_NODE 10 /* Mean North/Ascending Node */
44
+ #define SE_TRUE_NODE 11 /* True North/Ascending Node */
45
+ #define SE_MEAN_APOG 12 /* Mean Apogee */
46
+ #define SE_OSCU_APOG 13 /* Osculating Apogee */
47
+ #define SE_EARTH 14 /* Earth */
48
+ #define SE_CHIRON 15 /* Chiron */
49
+ #define SE_PHOLUS 16 /* Pholus */
50
+ #define SE_CERES 17 /* Ceres */
51
+ #define SE_PALLAS 18 /* Pallas */
52
+ #define SE_JUNO 19 /* Juno */
53
+ #define SE_VESTA 20 /* Vesta */
54
+ #define SE_INTP_APOG 21 /* Interpolated Apogee */
55
+ #define SE_INTP_PERG 22 /* Interpolated Perigee */
56
+
57
+ /*
58
+ * Flag bits used by the swe_calc_ut() method
59
+ * See http://www.astro.com/swisseph/swephprg.htm#_Toc283735427
60
+ */
61
+ #define SEFLG_JPLEPH 1 /* use JPL ephemeris */
62
+ #define SEFLG_SWIEPH 2 /* use SWISSEPH ephemeris */
63
+ #define SEFLG_MOSEPH 4 /* use Moshier ephemeris */
64
+ #define SEFLG_HELCTR 8 /* return heliocentric position */
65
+ #define SEFLG_TRUEPOS 16 /* return true positions, not apparent */
66
+ #define SEFLG_J2000 32 /* no precession, i.e. give J2000 equinox */
67
+ #define SEFLG_NONUT 64 /* no nutation, i.e. mean equinox of date */
68
+ #define SEFLG_SPEED3 128 /* speed from 3 positions (do not use it, SEFLG_SPEED is faster and more precise.) */
69
+ #define SEFLG_SPEED 256 /* high precision speed */
70
+ #define SEFLG_NOGDEFL 512 /* turn off gravitational deflection */
71
+ #define SEFLG_NOABERR 1024 /* turn off 'annual' aberration of light */
72
+ #define SEFLG_EQUATORIAL (2*1024) /* equatorial positions are wanted */
73
+ #define SEFLG_XYZ (4*1024) /* cartesian, not polar, coordinates */
74
+ #define SEFLG_RADIANS (8*1024) /* coordinates in radians, not degrees */
75
+ #define SEFLG_BARYCTR (16*1024) /* barycentric positions */
76
+ #define SEFLG_TOPOCTR (32*1024) /* topocentric positions */
77
+ #define SEFLG_SIDEREAL (64*1024) /* sidereal positions */
78
+ #define SEFLG_ICRS (128*1024) /* ICRS (DE406 reference frame) */
79
+
80
+ /*
81
+ * Sidereal modes used by the swe_set_sid_mode() method
82
+ * See http://www.astro.com/swisseph/swephprg.htm#_Toc283735477
83
+ */
84
+ #define SE_SIDM_FAGAN_BRADLEY 0 /* Fagan/Bradley) */
85
+ #define SE_SIDM_LAHIRI 1 /* Lahiri */
86
+ #define SE_SIDM_DELUCE 2 /* De Luce */
87
+ #define SE_SIDM_RAMAN 3 /* Raman */
88
+ #define SE_SIDM_USHASHASHI 4 /* Ushashashi */
89
+ #define SE_SIDM_KRISHNAMURTI 5 /* Krishnamurti */
90
+ #define SE_SIDM_DJWHAL_KHUL 6 /* Djwhal Khul */
91
+ #define SE_SIDM_YUKTESHWAR 7 /* Yukteshvar */
92
+ #define SE_SIDM_JN_BHASIN 8 /* JN Bhasin */
93
+ #define SE_SIDM_BABYL_KUGLER1 9 /* Babylonian Kugler 1 */
94
+ #define SE_SIDM_BABYL_KUGLER2 10 /* Babylonian Kugler 2 */
95
+ #define SE_SIDM_BABYL_KUGLER3 11 /* Babylonian Kugler 3 */
96
+ #define SE_SIDM_BABYL_HUBER 12 /* Babylonian Huber*/
97
+ #define SE_SIDM_BABYL_ETPSC 13 /* Babylonian Spica at 29 vi 21 */
98
+ #define SE_SIDM_ALDEBARAN_15TAU 14 /* Aldebaran 15 Taurus */
99
+ #define SE_SIDM_HIPPARCHOS 15 /* Hipparchos */
100
+ #define SE_SIDM_SASSANIAN 16 /* Sassanian */
101
+ #define SE_SIDM_GALCENT_0SAG 17 /* Galactic Center at 0 Sagittarius */
102
+ #define SE_SIDM_J2000 18 /* J2000 */
103
+ #define SE_SIDM_J1900 19 /* J1900 */
104
+ #define SE_SIDM_B1950 20 /* B1950 */
105
+ #define SE_SIDM_USER 255 /* User Defined */
106
+
107
+ /*
108
+ * Set directory path of ephemeris files
109
+ * http://www.astro.com/swisseph/swephprg.htm#_Toc283735481
110
+ * int swe_set_ephe_path(char *path);
111
+ */
9
112
  static VALUE t_swe_set_ephe_path(VALUE self, VALUE path)
10
113
  {
11
114
  swe_set_ephe_path(StringValuePtr(path));
12
115
  return Qnil;
13
116
  }
14
117
 
15
- // Get the Julian day number from year, month, day, hour
16
- // double swe_julday(
17
- // int year,
18
- // int month,
19
- // int day,
20
- // double hour,
21
- // int gregflag /* Gregorian calendar: 1, Julian calendar: 0 */
22
- // );
118
+ /*
119
+ * Get the Julian day number from year, month, day, hour
120
+ * http://www.astro.com/swisseph/swephprg.htm#_Toc283735468
121
+ double swe_julday(
122
+ int year,
123
+ int month,
124
+ int day,
125
+ double hour,
126
+ int gregflag // Gregorian calendar: 1, Julian calendar: 0
127
+ );
128
+ */
23
129
  static VALUE t_swe_julday(VALUE self, VALUE year, VALUE month, VALUE day, VALUE hour)
24
130
  {
25
131
  double julday = swe_julday( NUM2INT(year), NUM2INT(month), NUM2INT(day), NUM2DBL(hour), SE_GREG_CAL );
26
132
  return rb_float_new(julday);
27
133
  }
28
134
 
29
- // Set the geographic location for topocentric planet computation
30
- // The longitude and latitude must be in degrees, the altitude in meters.
31
- // void swe_set_topo (
32
- // double geolon, /* geographic longitude: eastern longitude is positive, western longitude is negative */
33
- // double geolat, /* geographic latitude: northern latitude is positive, southern latitude is negative */
34
- // double altitude /* altitude above sea*/
35
- // );
135
+ /*
136
+ * Set the geographic location for topocentric planet computation
137
+ * The longitude and latitude must be in degrees, the altitude in meters.
138
+ * http://www.astro.com/swisseph/swephprg.htm#_Toc283735476
139
+ void swe_set_topo (
140
+ double geolon, // geographic longitude: eastern longitude is positive, western longitude is negative
141
+ double geolat, // geographic latitude: northern latitude is positive, southern latitude is negative
142
+ double altitude // altitude above sea
143
+ );
144
+ */
36
145
  static VALUE t_swe_set_topo(VALUE self, VALUE lon, VALUE lat, VALUE alt) {
37
146
  swe_set_topo(NUM2DBL(lon),NUM2DBL(lat),NUM2DBL(alt));
38
147
  return Qnil;
39
148
  }
40
149
 
41
- // Calculation of planets, moon, asteroids, lunar nodes, apogees, fictitious bodies
42
- // long swe_calc_ut(
43
- // double tjd_ut, /* Julian day number, Universal Time */
44
- // int ipl, /* planet number */
45
- // long iflag, /* flag bits */
46
- // double *xx, /* target address for 6 position values: longitude, latitude, distance, long.speed, lat.speed, dist. peed */
47
- // char *serr /* 256 bytes for error string */
48
- // );
150
+ /*
151
+ * Calculation of planets, moon, asteroids, lunar nodes, apogees, fictitious bodies
152
+ * http://www.astro.com/swisseph/swephprg.htm#_Toc283735419
153
+ long swe_calc_ut(
154
+ double tjd_ut, // Julian day number, Universal Time
155
+ int ipl, // planet number
156
+ long iflag, // flag bits
157
+ double *xx, // target address for 6 position values: longitude, latitude, distance, long.speed, lat.speed, dist.speed
158
+ char *serr // 256 bytes for error string
159
+ );
160
+ */
49
161
  static VALUE t_swe_calc_ut(VALUE self, VALUE julian_ut, VALUE body, VALUE iflag) {
50
162
  double results[6];
51
163
  char serr[AS_MAXCH];
@@ -62,39 +174,61 @@ static VALUE t_swe_calc_ut(VALUE self, VALUE julian_ut, VALUE body, VALUE iflag)
62
174
  return arr;
63
175
  }
64
176
 
65
- // This function can be used to specify the mode for sidereal computations.
66
- // void swe_set_sid_mode (
67
- // int32 sid_mode, /* Mode */
68
- // double t0, /* Reference date */
69
- // double ayan_t0 /* Initial value of the ayanamsha */
70
- // );
177
+ /*
178
+ * This function can be used to specify the mode for sidereal computations
179
+ * http://www.astro.com/swisseph/swephprg.htm#_Toc283735478
180
+ void swe_set_sid_mode (
181
+ int32 sid_mode, // Mode
182
+ double t0, // Reference date
183
+ double ayan_t0 // Initial value of the ayanamsha
184
+ );
185
+ */
71
186
  static VALUE t_swe_set_sid_mode(VALUE self, VALUE mode, VALUE t0, VALUE ayan_t0) {
72
187
  swe_set_sid_mode(NUM2INT(mode), NUM2DBL(t0), NUM2DBL(ayan_t0));
73
188
  return Qnil;
74
189
  }
75
190
 
76
- // This function computes the ayanamsha, the distance of the tropical vernal point from the sidereal zero point of the zodiac.
77
- // The ayanamsha is used to compute sidereal planetary positions from tropical ones:
78
- // pos_sid = pos_trop ayanamsha
79
- // Before calling swe_get_ayanamsha(), you have to set the sidereal mode with swe_set_sid_mode, unless you want the default sidereal mode, which is the Fagan/Bradley ayanamsha.
80
- // double swe_get_ayanamsa_ut(double tjd_ut);
191
+ /*
192
+ * This function computes the ayanamsha, the distance of the tropical vernal point from the sidereal zero point of the zodiac.
193
+ * The ayanamsha is used to compute sidereal planetary positions from tropical ones:
194
+ * pos_sid = pos_trop ayanamsha
195
+ * Before calling swe_get_ayanamsha(), you have to set the sidereal mode with swe_set_sid_mode, unless you want the default sidereal mode, which is the Fagan/Bradley ayanamsha.
196
+ * http://www.astro.com/swisseph/swephprg.htm#_Toc283735479
197
+ * double swe_get_ayanamsa_ut(double tjd_ut);
198
+ */
81
199
  static VALUE t_swe_get_ayanamsa_ut(VALUE self, VALUE julian_ut) {
82
200
  double ayanamsa = swe_get_ayanamsa_ut(NUM2DBL(julian_ut));
83
201
  return rb_float_new(ayanamsa);
84
202
  }
85
203
 
86
- // This function computes house cusps, ascendant, midheaven, etc
87
- // int swe_houses(
88
- // double tjd_ut, /* Julian day number, UT */
89
- // double geolat, /* geographic latitude, in degrees */
90
- // double geolon, /* geographic longitude, in degrees
91
- // * eastern longitude is positive,
92
- // * western longitude is negative,
93
- // * northern latitude is positive,
94
- // * southern latitude is negative */
95
- // int hsys, /* house method, ascii code of one of the letters PKORCAEVXHTBG */
96
- // double *cusps, /* array for 13 doubles */
97
- // double *ascmc); /* array for 10 doubles */
204
+ /*
205
+ * This function computes house cusps, ascendant, midheaven, etc
206
+ * http://www.astro.com/swisseph/swephprg.htm#_Toc283735486
207
+ int swe_houses(
208
+ double tjd_ut, // Julian day number, UT
209
+ double geolat, // geographic latitude, in degrees
210
+ double geolon, // geographic longitude, in degrees (eastern longitude is positive, western longitude is negative, northern latitude is positive, southern latitude is negative
211
+ int hsys, // house method, ascii code of one of the letters PKORCAEVXHTBG
212
+ double *cusps, // array for 13 doubles
213
+ double *ascmc // array for 10 doubles
214
+ );
215
+ * House method codes...
216
+ * ‘P’ = Placidus
217
+ * ‘K’ = Koch
218
+ * ‘O’ = Porphyrius
219
+ * ‘R’ = Regiomontanus
220
+ * ‘C’ = Campanus
221
+ * ‘A’ or ‘E’ = Equal (cusp 1 is Ascendant)
222
+ * ‘V’ = Vehlow equal (Asc. in middle of house 1)
223
+ * ‘W’ = Whole sign
224
+ * ‘X’ = axial rotation system
225
+ * ‘H’ = azimuthal or horizontal system
226
+ * ‘T’ = Polich/Page (“topocentric” system)
227
+ * ‘B’ = Alcabitus
228
+ * ‘M’ = Morinus
229
+ * ‘U’ = Krusinski-Pisa
230
+ * ‘G’ = Gauquelin sectors
231
+ */
98
232
  static VALUE t_swe_houses(VALUE self, VALUE julian_day, VALUE latitude, VALUE longitude, VALUE house_system)
99
233
  {
100
234
  double cusps[13];
@@ -118,12 +252,82 @@ static VALUE t_swe_houses(VALUE self, VALUE julian_day, VALUE latitude, VALUE lo
118
252
 
119
253
  void Init_swe4r()
120
254
  {
255
+ // Module
121
256
  rb_mSwe4r = rb_define_module ("Swe4r");
122
- rb_define_method(rb_mSwe4r, "swe_set_ephe_path", t_swe_set_ephe_path, 1);
123
- rb_define_method(rb_mSwe4r, "swe_julday", t_swe_julday, 4);
124
- rb_define_method(rb_mSwe4r, "swe_set_topo", t_swe_set_topo, 3);
125
- rb_define_method(rb_mSwe4r, "swe_calc_ut", t_swe_calc_ut, 3);
126
- rb_define_method(rb_mSwe4r, "swe_set_sid_mode", t_swe_set_sid_mode, 3);
127
- rb_define_method(rb_mSwe4r, "swe_get_ayanamsa_ut", t_swe_get_ayanamsa_ut, 1);
128
- rb_define_method(rb_mSwe4r, "swe_houses", t_swe_houses, 4);
257
+
258
+ // Module Functions
259
+ rb_define_module_function(rb_mSwe4r, "swe_set_ephe_path", t_swe_set_ephe_path, 1);
260
+ rb_define_module_function(rb_mSwe4r, "swe_julday", t_swe_julday, 4);
261
+ rb_define_module_function(rb_mSwe4r, "swe_set_topo", t_swe_set_topo, 3);
262
+ rb_define_module_function(rb_mSwe4r, "swe_calc_ut", t_swe_calc_ut, 3);
263
+ rb_define_module_function(rb_mSwe4r, "swe_set_sid_mode", t_swe_set_sid_mode, 3);
264
+ rb_define_module_function(rb_mSwe4r, "swe_get_ayanamsa_ut", t_swe_get_ayanamsa_ut, 1);
265
+ rb_define_module_function(rb_mSwe4r, "swe_houses", t_swe_houses, 4);
266
+
267
+ // Constants
268
+ rb_define_const(rb_mSwe4r, "SE_SUN", INT2FIX(SE_SUN));
269
+ rb_define_const(rb_mSwe4r, "SE_MOON", INT2FIX(SE_MOON));
270
+ rb_define_const(rb_mSwe4r, "SE_MERCURY", INT2FIX(SE_MERCURY));
271
+ rb_define_const(rb_mSwe4r, "SE_VENUS", INT2FIX(SE_VENUS));
272
+ rb_define_const(rb_mSwe4r, "SE_MARS", INT2FIX(SE_MARS));
273
+ rb_define_const(rb_mSwe4r, "SE_JUPITER", INT2FIX(SE_JUPITER));
274
+ rb_define_const(rb_mSwe4r, "SE_SATURN", INT2FIX(SE_SATURN));
275
+ rb_define_const(rb_mSwe4r, "SE_URANUS", INT2FIX(SE_URANUS));
276
+ rb_define_const(rb_mSwe4r, "SE_NEPTUNE", INT2FIX(SE_NEPTUNE));
277
+ rb_define_const(rb_mSwe4r, "SE_PLUTO", INT2FIX(SE_PLUTO));
278
+ rb_define_const(rb_mSwe4r, "SE_MEAN_NODE", INT2FIX(SE_MEAN_NODE));
279
+ rb_define_const(rb_mSwe4r, "SE_TRUE_NODE", INT2FIX(SE_TRUE_NODE));
280
+ rb_define_const(rb_mSwe4r, "SE_MEAN_APOG", INT2FIX(SE_MEAN_APOG));
281
+ rb_define_const(rb_mSwe4r, "SE_OSCU_APOG", INT2FIX(SE_OSCU_APOG));
282
+ rb_define_const(rb_mSwe4r, "SE_EARTH", INT2FIX(SE_EARTH));
283
+ rb_define_const(rb_mSwe4r, "SE_CHIRON", INT2FIX(SE_CHIRON));
284
+ rb_define_const(rb_mSwe4r, "SE_PHOLUS", INT2FIX(SE_PHOLUS));
285
+ rb_define_const(rb_mSwe4r, "SE_CERES", INT2FIX(SE_CERES));
286
+ rb_define_const(rb_mSwe4r, "SE_PALLAS", INT2FIX(SE_PALLAS));
287
+ rb_define_const(rb_mSwe4r, "SE_JUNO", INT2FIX(SE_JUNO));
288
+ rb_define_const(rb_mSwe4r, "SE_VESTA", INT2FIX(SE_VESTA));
289
+ rb_define_const(rb_mSwe4r, "SE_INTP_APOG", INT2FIX(SE_INTP_APOG));
290
+ rb_define_const(rb_mSwe4r, "SE_INTP_PERG", INT2FIX(SE_INTP_PERG));
291
+
292
+ rb_define_const(rb_mSwe4r, "SEFLG_JPLEPH", INT2FIX(SEFLG_JPLEPH));
293
+ rb_define_const(rb_mSwe4r, "SEFLG_SWIEPH", INT2FIX(SEFLG_SWIEPH));
294
+ rb_define_const(rb_mSwe4r, "SEFLG_MOSEPH", INT2FIX(SEFLG_MOSEPH));
295
+ rb_define_const(rb_mSwe4r, "SEFLG_HELCTR", INT2FIX(SEFLG_HELCTR));
296
+ rb_define_const(rb_mSwe4r, "SEFLG_TRUEPOS", INT2FIX(SEFLG_TRUEPOS));
297
+ rb_define_const(rb_mSwe4r, "SEFLG_J2000", INT2FIX(SEFLG_J2000));
298
+ rb_define_const(rb_mSwe4r, "SEFLG_NONUT", INT2FIX(SEFLG_NONUT));
299
+ rb_define_const(rb_mSwe4r, "SEFLG_SPEED3", INT2FIX(SEFLG_SPEED3));
300
+ rb_define_const(rb_mSwe4r, "SEFLG_SPEED", INT2FIX(SEFLG_SPEED));
301
+ rb_define_const(rb_mSwe4r, "SEFLG_NOGDEFL", INT2FIX(SEFLG_NOGDEFL));
302
+ rb_define_const(rb_mSwe4r, "SEFLG_NOABERR", INT2FIX(SEFLG_NOABERR));
303
+ rb_define_const(rb_mSwe4r, "SEFLG_EQUATORIAL", INT2FIX(SEFLG_EQUATORIAL));
304
+ rb_define_const(rb_mSwe4r, "SEFLG_XYZ", INT2FIX(SEFLG_XYZ));
305
+ rb_define_const(rb_mSwe4r, "SEFLG_RADIANS", INT2FIX(SEFLG_RADIANS));
306
+ rb_define_const(rb_mSwe4r, "SEFLG_BARYCTR", INT2FIX(SEFLG_BARYCTR));
307
+ rb_define_const(rb_mSwe4r, "SEFLG_TOPOCTR", INT2FIX(SEFLG_TOPOCTR));
308
+ rb_define_const(rb_mSwe4r, "SEFLG_SIDEREAL", INT2FIX(SEFLG_SIDEREAL));
309
+ rb_define_const(rb_mSwe4r, "SEFLG_ICRS", INT2FIX(SEFLG_ICRS));
310
+
311
+ rb_define_const(rb_mSwe4r, "SE_SIDM_FAGAN_BRADLEY", INT2FIX(SE_SIDM_FAGAN_BRADLEY));
312
+ rb_define_const(rb_mSwe4r, "SE_SIDM_LAHIRI", INT2FIX(SE_SIDM_LAHIRI));
313
+ rb_define_const(rb_mSwe4r, "SE_SIDM_DELUCE", INT2FIX(SE_SIDM_DELUCE));
314
+ rb_define_const(rb_mSwe4r, "SE_SIDM_RAMAN", INT2FIX(SE_SIDM_RAMAN));
315
+ rb_define_const(rb_mSwe4r, "SE_SIDM_USHASHASHI", INT2FIX(SE_SIDM_USHASHASHI));
316
+ rb_define_const(rb_mSwe4r, "SE_SIDM_KRISHNAMURTI", INT2FIX(SE_SIDM_KRISHNAMURTI));
317
+ rb_define_const(rb_mSwe4r, "SE_SIDM_DJWHAL_KHUL", INT2FIX(SE_SIDM_DJWHAL_KHUL));
318
+ rb_define_const(rb_mSwe4r, "SE_SIDM_YUKTESHWAR", INT2FIX(SE_SIDM_YUKTESHWAR));
319
+ rb_define_const(rb_mSwe4r, "SE_SIDM_JN_BHASIN", INT2FIX(SE_SIDM_JN_BHASIN));
320
+ rb_define_const(rb_mSwe4r, "SE_SIDM_BABYL_KUGLER1", INT2FIX(SE_SIDM_BABYL_KUGLER1));
321
+ rb_define_const(rb_mSwe4r, "SE_SIDM_BABYL_KUGLER2", INT2FIX(SE_SIDM_BABYL_KUGLER2));
322
+ rb_define_const(rb_mSwe4r, "SE_SIDM_BABYL_KUGLER3", INT2FIX(SE_SIDM_BABYL_KUGLER3));
323
+ rb_define_const(rb_mSwe4r, "SE_SIDM_BABYL_HUBER", INT2FIX(SE_SIDM_BABYL_HUBER));
324
+ rb_define_const(rb_mSwe4r, "SE_SIDM_BABYL_ETPSC", INT2FIX(SE_SIDM_BABYL_ETPSC));
325
+ rb_define_const(rb_mSwe4r, "SE_SIDM_ALDEBARAN_15TAU", INT2FIX(SE_SIDM_ALDEBARAN_15TAU));
326
+ rb_define_const(rb_mSwe4r, "SE_SIDM_HIPPARCHOS", INT2FIX(SE_SIDM_HIPPARCHOS));
327
+ rb_define_const(rb_mSwe4r, "SE_SIDM_SASSANIAN", INT2FIX(SE_SIDM_SASSANIAN));
328
+ rb_define_const(rb_mSwe4r, "SE_SIDM_GALCENT_0SAG", INT2FIX(SE_SIDM_GALCENT_0SAG));
329
+ rb_define_const(rb_mSwe4r, "SE_SIDM_J2000", INT2FIX(SE_SIDM_J2000));
330
+ rb_define_const(rb_mSwe4r, "SE_SIDM_J1900", INT2FIX(SE_SIDM_J1900));
331
+ rb_define_const(rb_mSwe4r, "SE_SIDM_B1950", INT2FIX(SE_SIDM_B1950));
332
+ rb_define_const(rb_mSwe4r, "SE_SIDM_USER", INT2FIX(SE_SIDM_USER));
129
333
  }
data/lib/swe4r.rb CHANGED
@@ -1,2 +1,19 @@
1
- require 'swe4r/swe4r'
2
- include Swe4r
1
+ # Swe4r :: Swiss Ephemeris for Ruby - A C extension for the Swiss Ephemeris library (http://www.astro.com/swisseph/)
2
+ # Copyright (C) 2012 Andrew Kirk (andrew.kirk@windhorsemedia.com)
3
+ #
4
+ # This file is part of Swe4r.
5
+ #
6
+ # Swe4r is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Swe4r is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Swe4r. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require 'swe4r/swe4r'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swe4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,14 +9,15 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-22 00:00:00.000000000Z
12
+ date: 2012-05-14 00:00:00.000000000Z
13
13
  dependencies: []
14
- description:
14
+ description: A C extension for the Swiss Ephemeris library (http://www.astro.com/swisseph/)
15
15
  email: andrew.kirk@windhorsemedia.com
16
16
  executables: []
17
17
  extensions:
18
18
  - ext/swe4r/extconf.rb
19
- extra_rdoc_files: []
19
+ extra_rdoc_files:
20
+ - README.rdoc
20
21
  files:
21
22
  - lib/swe4r.rb
22
23
  - ext/swe4r/extconf.rb
@@ -39,8 +40,10 @@ files:
39
40
  - ext/swe4r/swemplan.c
40
41
  - ext/swe4r/sweph.c
41
42
  - ext/swe4r/swephlib.c
43
+ - README.rdoc
42
44
  homepage:
43
- licenses: []
45
+ licenses:
46
+ - GPL-2
44
47
  post_install_message:
45
48
  rdoc_options: []
46
49
  require_paths:
@@ -62,5 +65,5 @@ rubyforge_project:
62
65
  rubygems_version: 1.8.10
63
66
  signing_key:
64
67
  specification_version: 3
65
- summary: A C extension for the Swiss Ephemeris library (http://www.astro.com/swisseph/)
68
+ summary: Swiss Ephemeris for Ruby
66
69
  test_files: []