class Rubygoal::Coordinate

Public Instance Methods

add(coordinate) click to toggle source
# File lib/rubygoal/coordinate.rb, line 9
def add(coordinate)
  self.class.new(x + coordinate.x, y + coordinate.y)
end
distance(coordinate) click to toggle source
# File lib/rubygoal/coordinate.rb, line 5
def distance(coordinate)
  Util.distance(x, y, coordinate.x, coordinate.y)
end
mult(coeficient) click to toggle source
# File lib/rubygoal/coordinate.rb, line 13
def mult(coeficient)
  self.class.new(x * coeficient, y * coeficient)
end
to_hash() click to toggle source
# File lib/rubygoal/coordinate.rb, line 21
def to_hash
  { x: x, y: y }
end
to_s() click to toggle source
# File lib/rubygoal/coordinate.rb, line 17
def to_s
  "(#{x}, #{y})"
end