class RedEye::Region

Attributes

area_min_x[RW]
area_min_y[RW]

Public Instance Methods

centre() click to toggle source
# File lib/morandi/redeye.rb, line 47
def centre
  [@area_min_x.to_i + ((maxX + minX) >> 1),
   @area_min_y.to_i + ((maxY + minY) >> 1)]
end
distance_from(x,y) click to toggle source

Pythagorean

# File lib/morandi/redeye.rb, line 53
def distance_from(x,y)
  cx,cy = centre()

  dx = cx - x
  dy = cy - y

  Math.sqrt( (dx * dx) + (dy * dy) )
end