Class: Vector2
- Inherits:
-
Object
- Object
- Vector2
- Defined in:
- lib/sparkle_motion/vector2.rb
Overview
TODO: Namespacing! A 2-component vector, where components go from 0.0..1.0.
Instance Attribute Summary collapse
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
-
#initialize(x: 0.0, y: 0.0) ⇒ Vector2
constructor
A new instance of Vector2.
- #to_s ⇒ Object
Constructor Details
#initialize(x: 0.0, y: 0.0) ⇒ Vector2
Returns a new instance of Vector2.
5 6 7 8 |
# File 'lib/sparkle_motion/vector2.rb', line 5 def initialize(x: 0.0, y: 0.0) @x = x @y = y end |
Instance Attribute Details
#x ⇒ Object (readonly)
Returns the value of attribute x.
4 5 6 |
# File 'lib/sparkle_motion/vector2.rb', line 4 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
4 5 6 |
# File 'lib/sparkle_motion/vector2.rb', line 4 def y @y end |
Instance Method Details
#to_s ⇒ Object
10 |
# File 'lib/sparkle_motion/vector2.rb', line 10 def to_s; "<<#{@x}, #{@y}>>"; end |