//---------------------------------------------------------------- /// Rect vs Rect //---------------------------------------------------------------- bool Intersects(const Rectangle& inRectLHS, const Rectangle& inRectRHS) { Vector2 vMinLS(inRectLHS.BottomLeft()); Vector2 vMaxLS(inRectLHS.TopRight()); Vector2 vMinRS(inRectRHS.BottomLeft()); Vector2 vMaxRS(inRectRHS.TopRight()); return (vMaxLS.x > vMinRS.x && vMinLS.x < vMaxRS.x) && (vMaxLS.y > vMinRS.y && vMinLS.y < vMaxRS.y); }
//---------------------------------------------------------------- /// Rect vs Point //---------------------------------------------------------------- bool Intersects(const Rectangle& inRect, const Vector2& invPoint) { Vector2 bottLeft = inRect.BottomLeft(); Vector2 topRight = inRect.TopRight(); return invPoint.x >= bottLeft.x && invPoint.y >= bottLeft.y && invPoint.x <= topRight.x && invPoint.y <= topRight.y; }