Class: Physicist::Laboratory::ScientistView
- Inherits:
-
Metacosm::View
- Object
- Metacosm::View
- Physicist::Laboratory::ScientistView
- Defined in:
- lib/physicist/laboratory/views/scientist_view.rb
Instance Attribute Summary collapse
-
#display_name ⇒ Object
Returns the value of attribute display_name.
-
#position ⇒ Object
Returns the value of attribute position.
-
#scientist_id ⇒ Object
Returns the value of attribute scientist_id.
-
#space_id ⇒ Object
Returns the value of attribute space_id.
-
#t0 ⇒ Object
Returns the value of attribute t0.
-
#velocity ⇒ Object
Returns the value of attribute velocity.
Instance Method Summary collapse
Instance Attribute Details
#display_name ⇒ Object
Returns the value of attribute display_name.
6 7 8 |
# File 'lib/physicist/laboratory/views/scientist_view.rb', line 6 def display_name @display_name end |
#position ⇒ Object
Returns the value of attribute position.
6 7 8 |
# File 'lib/physicist/laboratory/views/scientist_view.rb', line 6 def position @position end |
#scientist_id ⇒ Object
Returns the value of attribute scientist_id.
5 6 7 |
# File 'lib/physicist/laboratory/views/scientist_view.rb', line 5 def scientist_id @scientist_id end |
#space_id ⇒ Object
Returns the value of attribute space_id.
5 6 7 |
# File 'lib/physicist/laboratory/views/scientist_view.rb', line 5 def space_id @space_id end |
#t0 ⇒ Object
Returns the value of attribute t0.
6 7 8 |
# File 'lib/physicist/laboratory/views/scientist_view.rb', line 6 def t0 @t0 end |
#velocity ⇒ Object
Returns the value of attribute velocity.
6 7 8 |
# File 'lib/physicist/laboratory/views/scientist_view.rb', line 6 def velocity @velocity end |
Instance Method Details
#body ⇒ Object
16 17 18 19 |
# File 'lib/physicist/laboratory/views/scientist_view.rb', line 16 def body # ... integrate physicist bodies ... @body ||= construct_body end |
#construct_body ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/physicist/laboratory/views/scientist_view.rb', line 21 def construct_body Physicist::Body.new( position: position, velocity: velocity, t0: t0 || Time.now, dimensions: [2,2] ) end |
#current ⇒ Object
at(t)
12 13 14 |
# File 'lib/physicist/laboratory/views/scientist_view.rb', line 12 def current # at(t) @body = body.at(Time.now, obstacles: workspace_view.obstacles) end |
#workspace_view ⇒ Object
30 31 32 |
# File 'lib/physicist/laboratory/views/scientist_view.rb', line 30 def workspace_view WorkspaceView.find_by(space_id: space_id) end |