bool VRect::Contains (const VRect& inRect) const { return ((inRect.GetLeft() - GetLeft()) > -kREAL_PIXEL_PRECISION && (inRect.GetRight() - GetRight()) < kREAL_PIXEL_PRECISION && (inRect.GetTop() - GetTop()) > -kREAL_PIXEL_PRECISION && (inRect.GetBottom() - GetBottom()) < kREAL_PIXEL_PRECISION); }
void VRect::Union (const VRect& inRect) { GReal newLeft = Min(fX, inRect.fX); GReal newTop = Min(fY, inRect.fY); GReal newRight = Max(GetRight(), inRect.GetRight()); GReal newBottom = Max(GetBottom(), inRect.GetBottom()); SetCoords(newLeft, newTop, newRight - newLeft, newBottom - newTop); }
void VRect::Intersect (const VRect& inRect) { GReal newLeft = Max(fX, inRect.GetX()); GReal newTop = Max(fY, inRect.GetY()); GReal newRight = Min(GetRight(), inRect.GetRight()); GReal newBottom = Min(GetBottom(), inRect.GetBottom()); if (newRight > newLeft && newBottom > newTop) SetCoords(newLeft, newTop, newRight - newLeft, newBottom - newTop); else SetCoords(0, 0, 0, 0); }
void VRect::Union (const VRect& inRect) { if (IsEmpty()) { fX = inRect.fX; fY = inRect.fY; fWidth = inRect.fWidth; fHeight = inRect.fHeight; } else if (!inRect.IsEmpty()) { GReal newLeft = Min(fX, inRect.fX); GReal newTop = Min(fY, inRect.fY); GReal newRight = Max(GetRight(), inRect.GetRight()); GReal newBottom = Max(GetBottom(), inRect.GetBottom()); SetCoords(newLeft, newTop, newRight - newLeft, newBottom - newTop); } }