Class: Orbiter::Free_body
- Inherits:
-
Object
- Object
- Orbiter::Free_body
- Defined in:
- lib/free_body.rb
Instance Attribute Summary collapse
-
#acc_x ⇒ Object
Returns the value of attribute acc_x.
-
#acc_y ⇒ Object
Returns the value of attribute acc_y.
-
#mass ⇒ Object
Returns the value of attribute mass.
-
#old_acc_x ⇒ Object
Returns the value of attribute old_acc_x.
-
#old_acc_y ⇒ Object
Returns the value of attribute old_acc_y.
-
#vel_x ⇒ Object
Returns the value of attribute vel_x.
-
#vel_y ⇒ Object
Returns the value of attribute vel_y.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Free_body
constructor
A new instance of Free_body.
Constructor Details
#initialize(attrs = {}) ⇒ Free_body
Returns a new instance of Free_body.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/free_body.rb', line 5 def initialize(attrs = {}) @mass = attrs.fetch(:mass, 10) @x = attrs.fetch(:x, 0) @y = attrs.fetch(:y, 0) @vel_x = attrs.fetch(:vel_x, 0) @vel_y = attrs.fetch(:vel_y, 0) @acc_x = attrs.fetch(:acc_x, 0) @acc_y = attrs.fetch(:acc_y, 0) @old_acc_x = attrs.fetch(:old_acc_x, 0) @old_acc_y = attrs.fetch(:old_acc_y, 0) end |
Instance Attribute Details
#acc_x ⇒ Object
Returns the value of attribute acc_x.
3 4 5 |
# File 'lib/free_body.rb', line 3 def acc_x @acc_x end |
#acc_y ⇒ Object
Returns the value of attribute acc_y.
3 4 5 |
# File 'lib/free_body.rb', line 3 def acc_y @acc_y end |
#mass ⇒ Object
Returns the value of attribute mass.
3 4 5 |
# File 'lib/free_body.rb', line 3 def mass @mass end |
#old_acc_x ⇒ Object
Returns the value of attribute old_acc_x.
3 4 5 |
# File 'lib/free_body.rb', line 3 def old_acc_x @old_acc_x end |
#old_acc_y ⇒ Object
Returns the value of attribute old_acc_y.
3 4 5 |
# File 'lib/free_body.rb', line 3 def old_acc_y @old_acc_y end |
#vel_x ⇒ Object
Returns the value of attribute vel_x.
3 4 5 |
# File 'lib/free_body.rb', line 3 def vel_x @vel_x end |
#vel_y ⇒ Object
Returns the value of attribute vel_y.
3 4 5 |
# File 'lib/free_body.rb', line 3 def vel_y @vel_y end |
#x ⇒ Object
Returns the value of attribute x.
3 4 5 |
# File 'lib/free_body.rb', line 3 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
3 4 5 |
# File 'lib/free_body.rb', line 3 def y @y end |