Class: Sweph
- Inherits:
-
Object
- Object
- Sweph
- Defined in:
- ext/sweph4ruby.c
Instance Method Summary collapse
- #initialize ⇒ Object constructor
- #swe_calc(julian_day, body) ⇒ Object
- #swe_deltat(tjd) ⇒ Object
- #swe_get_planet_name(body_number) ⇒ Object
- #swe_house_pos(armc, geolat, eps, house_system, lon, lat) ⇒ Object
- #swe_houses(julian_day, latitude, longitude, house_system) ⇒ Object
- #swe_julday(year, month, day, hour) ⇒ Object
- #swe_set_ephe_path(path) ⇒ Object
Constructor Details
#initialize ⇒ Object
4 5 6 7 |
# File 'ext/sweph4ruby.c', line 4
static VALUE t_init(VALUE self)
{
return self;
}
|
Instance Method Details
#swe_calc(julian_day, body) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'ext/sweph4ruby.c', line 21
static VALUE t_swe_calc(VALUE self, VALUE julian_day, VALUE body)
{
double results[6];
char serr[AS_MAXCH];
VALUE arr = rb_ary_new();
int id_push = rb_intern("push");
int i =0;
if ( swe_calc(NUM2DBL(julian_day), NUM2INT(body), SEFLG_SPEED, results, serr) < 0 )
rb_raise (rb_eRuntimeError, serr);
for ( i = 0; i < 6; i++)
rb_funcall(arr, id_push, 1, rb_float_new(results[i]));
return arr;
}
|
#swe_deltat(tjd) ⇒ Object
80 81 82 83 84 85 86 |
# File 'ext/sweph4ruby.c', line 80
static VALUE t_swe_deltat(VALUE self, VALUE tjd)
{
VALUE ret;
ret = swe_deltat(NUM2DBL(tjd));
return rb_float_new(ret);
}
|
#swe_get_planet_name(body_number) ⇒ Object
59 60 61 62 63 64 65 |
# File 'ext/sweph4ruby.c', line 59
static VALUE t_swe_get_planet_name(VALUE self, VALUE body_number)
{
char snam[40];
swe_get_planet_name(NUM2INT(body_number), snam);
return rb_str_new2(snam);
}
|
#swe_house_pos(armc, geolat, eps, house_system, lon, lat) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'ext/sweph4ruby.c', line 67
static VALUE t_swe_house_pos(VALUE self, VALUE armc, VALUE geolat, VALUE eps, VALUE house_system, VALUE lon, VALUE lat)
{
double xpin[2];
char serr[AS_MAXCH];
VALUE house;
xpin[0] = NUM2DBL(lon);
xpin[1] = NUM2DBL(lat);
house = swe_house_pos(NUM2DBL(armc), NUM2DBL(geolat), NUM2DBL(eps), NUM2CHR(house_system), xpin, serr);
return rb_float_new(house);
}
|
#swe_houses(julian_day, latitude, longitude, house_system) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'ext/sweph4ruby.c', line 38
static VALUE t_swe_houses(VALUE self, VALUE julian_day, VALUE latitude, VALUE longitude, VALUE house_system)
{
double cusps[13];
double ascmc[10];
char serr[AS_MAXCH];
VALUE arr = rb_ary_new();
int id_push = rb_intern("push");
int i =0;
if ( swe_houses(NUM2DBL(julian_day), NUM2DBL(latitude), NUM2DBL(longitude), NUM2CHR(house_system), cusps, ascmc) < 0 )
rb_raise (rb_eRuntimeError, serr);
for ( i = 0; i < 13; i++)
rb_funcall(arr, id_push, 1, rb_float_new(cusps[i]));
for ( i = 0; i < 10; i++)
rb_funcall(arr, id_push, 1, rb_float_new(ascmc[i]));
return arr;
}
|
#swe_julday(year, month, day, hour) ⇒ Object
15 16 17 18 19 |
# File 'ext/sweph4ruby.c', line 15
static VALUE t_swe_julday(VALUE self, VALUE year, VALUE month, VALUE day, VALUE hour)
{
VALUE julday = swe_julday( NUM2INT(year), NUM2INT(month), NUM2INT(day), NUM2DBL(hour), SE_GREG_CAL );
return rb_float_new(julday);
}
|
#swe_set_ephe_path(path) ⇒ Object
9 10 11 12 13 |
# File 'ext/sweph4ruby.c', line 9
static VALUE t_swe_set_ephe_path(VALUE self, VALUE path)
{
swe_set_ephe_path(StringValuePtr(path));
return self;
}
|