Class: Korba::Car
Instance Attribute Summary collapse
-
#epoch ⇒ Object
readonly
Returns the value of attribute epoch.
-
#object_name ⇒ Object
readonly
Returns the value of attribute object_name.
-
#vx ⇒ Object
readonly
Returns the value of attribute vx.
-
#vy ⇒ Object
readonly
Returns the value of attribute vy.
-
#vz ⇒ Object
readonly
Returns the value of attribute vz.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
-
#z ⇒ Object
readonly
Returns the value of attribute z.
Instance Method Summary collapse
-
#initialize(object_name:, epoch:, x:, y:, z:, vx:, vy:, vz:) ⇒ Car
constructor
A new instance of Car.
- #to_kep ⇒ Object
Methods included from OrbitUtils
#deg_to_rad, #height_at_apogee, #height_at_perigee, #normalize_deg, #normalize_rad, #path_angle, #rad_to_deg
Constructor Details
#initialize(object_name:, epoch:, x:, y:, z:, vx:, vy:, vz:) ⇒ Car
Returns a new instance of Car.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/korba/car.rb', line 9 def initialize(object_name:, epoch:, x:, y:, z:, vx:, vy:, vz:) @object_name = object_name @epoch = epoch @x = x @y = y @z = z @vx = vx @vy = vy @vz = vz end |
Instance Attribute Details
#epoch ⇒ Object (readonly)
Returns the value of attribute epoch.
7 8 9 |
# File 'lib/korba/car.rb', line 7 def epoch @epoch end |
#object_name ⇒ Object (readonly)
Returns the value of attribute object_name.
7 8 9 |
# File 'lib/korba/car.rb', line 7 def object_name @object_name end |
#vx ⇒ Object (readonly)
Returns the value of attribute vx.
7 8 9 |
# File 'lib/korba/car.rb', line 7 def vx @vx end |
#vy ⇒ Object (readonly)
Returns the value of attribute vy.
7 8 9 |
# File 'lib/korba/car.rb', line 7 def vy @vy end |
#vz ⇒ Object (readonly)
Returns the value of attribute vz.
7 8 9 |
# File 'lib/korba/car.rb', line 7 def vz @vz end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
7 8 9 |
# File 'lib/korba/car.rb', line 7 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
7 8 9 |
# File 'lib/korba/car.rb', line 7 def y @y end |
#z ⇒ Object (readonly)
Returns the value of attribute z.
7 8 9 |
# File 'lib/korba/car.rb', line 7 def z @z end |
Instance Method Details
#to_kep ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/korba/car.rb', line 20 def to_kep inclination = rad_to_deg(Math.atan2(Math.sqrt(specific_angular_momentum_vector[0] ** 2 + specific_angular_momentum_vector[1] ** 2), specific_angular_momentum_vector[2])) ra_of_asc_node = rad_to_deg(Math.atan2(specific_angular_momentum_vector[0], -specific_angular_momentum_vector[1])) Kep.new(object_name:, epoch:, semi_major_axis:, eccentricity:, inclination:, ra_of_asc_node:, arg_of_pericenter: normalize_deg(arg_of_latitude - true_anomaly), mean_anomaly: rad_to_deg(deg_to_rad(eccentric_anomaly) - eccentricity * Math.sin(deg_to_rad(eccentric_anomaly)))) end |