bool coordinatesInRect(double x, double y, Rect rect) { return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom; }