|
cangine
|
An axis-aligned rectangle with a position, size and color. More...
#include <rectangle.hpp>

Static Public Member Functions | |
| static bool | containsPoint (const Rectangle &rect, const Transform &transform, const Vector2 &point) |
| Tests whether a point lies inside a (possibly transformed) rectangle. | |
| static bool | overlaps (const Rectangle &r1, const Transform &t1, const Rectangle &r2, const Transform &t2) |
| Tests whether two (possibly transformed) rectangles overlap. | |
Public Attributes | |
| Vector3 | pos |
| Center position (z is the layer). | |
| float | width |
| Width before scaling. | |
| float | height |
| Height before scaling. | |
| Color | color |
| Fill color. | |
An axis-aligned rectangle with a position, size and color.
The geometry is axis-aligned in its own space, but the static helpers accept a Transform so they can perform rotated/scaled hit-tests and collision checks via the Separating Axis Theorem.
|
inlinestatic |
Tests whether a point lies inside a (possibly transformed) rectangle.
| rect | Rectangle whose width/height define the bounds. |
| transform | Transform supplying position, rotation and scale. |
| point | Point to test, in world/screen space. |
true if the point is inside the rectangle, false otherwise.
|
inlinestatic |
Tests whether two (possibly transformed) rectangles overlap.
Uses the Separating Axis Theorem over the four edge normals of the two rectangles, so rotation and scale are respected.
| r1 | First rectangle (provides width/height). |
| t1 | Transform for the first rectangle. |
| r2 | Second rectangle (provides width/height). |
| t2 | Transform for the second rectangle. |
true if the rectangles intersect, false otherwise. | Color cangine::Rectangle::color |
Fill color.
| float cangine::Rectangle::height |
Height before scaling.
| Vector3 cangine::Rectangle::pos |
Center position (z is the layer).
| float cangine::Rectangle::width |
Width before scaling.