bool Position::IsPositionWithinArea(Area& Ar) { return (mX <= Ar.GetLowerRight().GetX()) && (mX >= Ar.GetUpperLeft().GetX()) && (mY <= Ar.GetLowerRight().GetY()) && (mY >= Ar.GetUpperLeft().GetY()); }
/***************************************************************************** * Function - BringPositionWithinArea * DESCRIPTION: * Brings the Position within the area *****************************************************************************/ void Position::BringPositionWithinArea(Area& Ar) { Position UpperLeftPos = Ar.GetUpperLeft(); Position LowerRightPos = Ar.GetLowerRight(); if (mX < UpperLeftPos.GetX()) { mX = UpperLeftPos.GetX(); } else if (mX > LowerRightPos.GetX()) { mX = LowerRightPos.GetX(); } if (mY < UpperLeftPos.GetY()) { mY = UpperLeftPos.GetY(); } else if (mY > LowerRightPos.GetY()) { mY = LowerRightPos.GetY(); } }