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
|
# File 'lib/horoscope.rb', line 47
def compute
return @errors if validate_values.size > 0
tpos = [10980, 16233, 15880, 16451, 15210, 13722, 13862, 7676, 4306, 15106]
tsp, pos, spd = [Array.new(10, 0), Array.new(10, 0), Array.new(10, 0)]
jd = Planet.get_jul_day(@datetime.month, @datetime.day, @datetime.year)
time = @datetime.hour + (@datetime.min / 60.0)
time -= @zone
jd += time / 24.0
t = (jd - 0.5 - Planet::J2000) / 36525.0
Planet.get_planets(t, pos, spd)
pos[0] = Planet.ascendant(t, time, @lon, @lat)
ayn = Planet.get_ayan(t)
(0..9).each do |i|
tpos[i] = ((pos[i] + ayn) % 360.0 * 60.0).to_i
if tpos[i] < 0
tpos = tpos
n = i
tpos[n] += 21600
end
tsp[i] = (spd[i] * 3600.0).to_i
end
count = 0
(0..11).each do |i|
(0..9).each do |j|
if (tpos[j] / 1800 == i)
@positions[PLANETS[j]] = i
@positions_rev[i] << PLANETS[j]
end
end
end
@computed = true
return @positions
end
|