Sha256: e65ae464af6ea4d60065c9367ba8431cdaf1b50410cf5f862079893e266301d1

Contents?: true

Size: 335 Bytes

Versions: 1

Compression:

Stored size: 335 Bytes

Contents

class GeometricPoint < Struct.new(:x, :y)

  def self.new_by_array(array)
    self.new(array[0], array[1])
  end

  def to_vector
    GeometricVector.new(x, y)
  end

  def advance_by(vector)
    GeometricPoint.new(x + vector.x, y + vector.y)
  end

  def ==(another_point)
    x === another_point.x && y === another_point.y
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flash_math-0.0.1 lib/flash_math/modules/geometry/geometric_point.rb