Class: Orbiter::Free_body

Inherits:
Object
  • Object
show all
Defined in:
lib/free_body.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_xObject

Returns the value of attribute acc_x.



3
4
5
# File 'lib/free_body.rb', line 3

def acc_x
  @acc_x
end

#acc_yObject

Returns the value of attribute acc_y.



3
4
5
# File 'lib/free_body.rb', line 3

def acc_y
  @acc_y
end

#massObject

Returns the value of attribute mass.



3
4
5
# File 'lib/free_body.rb', line 3

def mass
  @mass
end

#old_acc_xObject

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_yObject

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_xObject

Returns the value of attribute vel_x.



3
4
5
# File 'lib/free_body.rb', line 3

def vel_x
  @vel_x
end

#vel_yObject

Returns the value of attribute vel_y.



3
4
5
# File 'lib/free_body.rb', line 3

def vel_y
  @vel_y
end

#xObject

Returns the value of attribute x.



3
4
5
# File 'lib/free_body.rb', line 3

def x
  @x
end

#yObject

Returns the value of attribute y.



3
4
5
# File 'lib/free_body.rb', line 3

def y
  @y
end