lib/gamebox/lib/rect.rb
# Expand the caller to also cover the given Rect. The Rect is still a 
# rectangle, so it may also cover areas that neither of the original
# Rects did, for example areas between the two Rects.
Expand the caller to also cover the given Rect. The Rect is still a
rectangle, so it may also cover areas that neither of the original
Rects did, for example areas between the two Rects.
Expand the caller to also cover the given Rect . The Rect is still a rectangle so it may also cover areas that neither of the original Rects did for example areas between the two Rects .
def union!(rect)
    self.normalize!
    rleft, rtop = self.topleft
    rright, rbottom = self.bottomright
    r2 = Rect.new_from_object(rect).normalize!
    rleft = [rleft, r2.left].min
    rtop = [rtop, r2.top].min
    rright = [rright, r2.right].max
    rbottom = [rbottom, r2.bottom].max
    self[0,4] = rleft, rtop, rright - rleft, rbottom - rtop
    return self
  end
def union! ( rect ) self . normalize! rleft , rtop = self . topleft rright , rbottom = self . bottomright r2 = Rect . new_from_object ( rect ) . normalize! rleft = [ rleft , r2 . left ] . min rtop = [ rtop , r2 . top ] . min rright = [ rright , r2 . right ] . max rbottom = [ rbottom , r2 . bottom ] . max self [ 0 , 4 ] = rleft , rtop , rright - rleft , rbottom - rtop return self end
Expand the caller to also cover the given Rect.
Expand the caller to also cover the given Rect .
rect
<not_specific>