Sha256: f3038c93191eeeed0bc314fdb66c2ca7ba5c99be589546c00dab24052a227591
Contents?: true
Size: 508 Bytes
Versions: 1
Compression:
Stored size: 508 Bytes
Contents
module Geometer class Point < Struct.new(:x, :y) def inspect "(#{x},#{y})" end def invert Point.new(-x,-y) end alias_method :-@, :invert def scale(sz) Point.new(x*sz,y*sz) end alias_method :*, :scale def divide(sz) scale(1.0/sz) end alias_method :/, :divide def translate(other_point) dx,dy = *other_point Point.new(x+dx, y+dy) end end module PointHelpers def coord(x,y); Point.new(x,y) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geometer-0.1.2 | lib/geometer/point.rb |