-
-
Notifications
You must be signed in to change notification settings - Fork 0
Rect
Imagment edited this page Mar 26, 2025
·
1 revision
The Rect class represents a rectangle in a 2D space, defined by its position (x, y) and size (width, height).
| Constructor | Description |
|---|---|
Rect(double x, double y, double width, double height) |
Creates a rectangle at (x, y) with the given width and height. |
Rect() |
Default constructor, initializes all values to 0.0. |
| Method | Description |
|---|---|
bool Contains(Vector2 point) const |
Checks if a given point is inside the rectangle. |
bool Overlaps(const Rect &other) const |
Checks if this rectangle overlaps with another rectangle. |
void Set(double x, double y, double width, double height) |
Updates the rectangle’s position and size. |
void Normalize() |
Adjusts width and height to be positive by modifying x and y if necessary. |
| Operator | Description |
|---|---|
operator== |
Returns true if both rectangles have the same position and size. |
operator!= |
Returns true if the rectangles are different. |