66left (static_cast<T>(rectangle.left)),
67top (static_cast<T>(rectangle.top)),
68width (static_cast<T>(rectangle.width)),
69height(static_cast<T>(rectangle.height))
81 T minX = std::min(left,
static_cast<T
>(left + width));
82 T maxX = std::max(left,
static_cast<T
>(left + width));
83 T minY = std::min(top,
static_cast<T
>(top + height));
84 T maxY = std::max(top,
static_cast<T
>(top + height));
86 return (x >= minX) && (x < maxX) && (y >= minY) && (y < maxY);
94 return contains(point.
x, point.
y);
103 return intersects(rectangle, intersection);
114 T r1MinX = std::min(left,
static_cast<T
>(left + width));
115 T r1MaxX = std::max(left,
static_cast<T
>(left + width));
116 T r1MinY = std::min(top,
static_cast<T
>(top + height));
117 T r1MaxY = std::max(top,
static_cast<T
>(top + height));
120 T r2MinX = std::min(rectangle.
left,
static_cast<T
>(rectangle.
left + rectangle.
width));
121 T r2MaxX = std::max(rectangle.
left,
static_cast<T
>(rectangle.
left + rectangle.
width));
122 T r2MinY = std::min(rectangle.
top,
static_cast<T
>(rectangle.
top + rectangle.
height));
123 T r2MaxY = std::max(rectangle.
top,
static_cast<T
>(rectangle.
top + rectangle.
height));
126 T interLeft = std::max(r1MinX, r2MinX);
127 T interTop = std::max(r1MinY, r2MinY);
128 T interRight = std::min(r1MaxX, r2MaxX);
129 T interBottom = std::min(r1MaxY, r2MaxY);
132 if ((interLeft < interRight) && (interTop < interBottom))
134 intersection =
Rect<T>(interLeft, interTop, interRight - interLeft, interBottom - interTop);
139 intersection =
Rect<T>(0, 0, 0, 0);
149 return (left.left == right.left) && (left.width == right.width) &&
150 (left.top == right.top) && (left.height == right.height);
158 return !(left == right);
Utility class for manipulating 2D axis aligned rectangles.
Rect()
Default constructor.
bool contains(T x, T y) const
Check if a point is inside the rectangle's area.
T width
Width of the rectangle.
T height
Height of the rectangle.
T left
Left coordinate of the rectangle.
T top
Top coordinate of the rectangle.
bool intersects(const Rect< T > &rectangle) const
Check the intersection between two rectangles.
Utility template class for manipulating 2-dimensional vectors.
T x
X coordinate of the vector.
T y
Y coordinate of the vector.
SFML_NETWORK_API bool operator==(const IpAddress &left, const IpAddress &right)
Overload of == operator to compare two IP addresses.
SFML_NETWORK_API bool operator!=(const IpAddress &left, const IpAddress &right)
Overload of != operator to compare two IP addresses.