Class: GeometricPoint
- Inherits:
-
Struct
- Object
- Struct
- GeometricPoint
- Defined in:
- lib/flash_math/modules/geometry/geometric_point.rb
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x
1 2 3 |
# File 'lib/flash_math/modules/geometry/geometric_point.rb', line 1 def x @x end |
#y ⇒ Object
Returns the value of attribute y
1 2 3 |
# File 'lib/flash_math/modules/geometry/geometric_point.rb', line 1 def y @y end |
Class Method Details
.new_by_array(array) ⇒ Object
3 4 5 |
# File 'lib/flash_math/modules/geometry/geometric_point.rb', line 3 def self.new_by_array(array) self.new(array[0], array[1]) end |
Instance Method Details
#==(another_point) ⇒ Object
15 16 17 |
# File 'lib/flash_math/modules/geometry/geometric_point.rb', line 15 def ==(another_point) x === another_point.x && y === another_point.y end |
#advance_by(vector) ⇒ Object
11 12 13 |
# File 'lib/flash_math/modules/geometry/geometric_point.rb', line 11 def advance_by(vector) GeometricPoint.new(x + vector.x, y + vector.y) end |
#to_vector ⇒ Object
7 8 9 |
# File 'lib/flash_math/modules/geometry/geometric_point.rb', line 7 def to_vector GeometricVector.new(x, y) end |