Sha256: 3d4d7dc47846021e640bd56ba42383514d0821f0b13f4aecc9714b76efa843f7
Contents?: true
Size: 602 Bytes
Versions: 3
Compression:
Stored size: 602 Bytes
Contents
module PurplishFrame module Point def *(aNumber) self.class.new(x*aNumber, y*aNumber) end def /(aNumber) self.class.new(x/aNumber, y/aNumber) end def close_to?(point, delta=[4, 4]) point = point.to_point delta = delta.to_point x.close_to?(point.x, delta.x) && y.close_to?(point.y, delta.y) end def distance_from(point) point = point.to_point Math.sqrt((x-point.x)*(x-point.x) + (y-point.y)*(y-point.y)) end def extent(size) size = size.to_size [[x, y], [size.width, size.height]].to_rect end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
purplish-frame-0.0.12 | lib/purplish-frame/non-ui/point.rb |
purplish-frame-0.0.11 | lib/purplish-frame/non-ui/point.rb |
purplish-frame-0.0.10 | lib/purplish-frame/non-ui/point.rb |