RectangleRotated
Generated from engine/math/rectangle_rotated.h at f525bc6. The text under each declaration is the header's own comment, word for word. About the reference says how these pages are made.
Audience: game code.
#include "engine/math/rectangle_rotated.h" · namespace labrador
struct RectangleRotated
Section titled “struct RectangleRotated”RectangleRotated · operator=
Section titled “RectangleRotated · operator=”RectangleRotated(const RectangleRotated&) = default;RectangleRotated& operator=(const RectangleRotated&) = default;RectangleRotated(const Point2F& center, const Vector2F& half_extents);bounding_box · shape_type · offset · center · edges · inflate
Section titled “bounding_box · shape_type · offset · center · edges · inflate”Point2F center() const override;void inflate(float amount) override;x_axis · y_axis · axis · half_extents · half_x_width · half_y_width · half_width
Section titled “x_axis · y_axis · axis · half_extents · half_x_width · half_y_width · half_width”Vector2F y_axis() const;Vector2F axis(int axis) const;Vector2F half_extents() const;float half_x_width() const;float half_y_width() const;float half_width(int axis) const;set_center
Section titled “set_center”void set_center(const Point2F& center);set_axes · set_x_axis · set_y_axis · set_half_extents · set_half_x_width · set_half_y_width
Section titled “set_axes · set_x_axis · set_y_axis · set_half_extents · set_half_x_width · set_half_y_width”void set_x_axis(const Vector2F& x_axis);void set_y_axis(const Vector2F& y_axis);void set_half_extents(const Vector2F& half_extents);void set_half_x_width(float half_x_width);void set_half_y_width(float half_y_width);Rotating a rectangle means writing BOTH axes, and this is the only way to do it.
set_x_axis and set_y_axis each validate the candidate against the partner axis as it currently stands, which is correct and which makes them useless for turning anything: the new x axis has to be perpendicular to the OLD y axis, so every genuine rotation is rejected whichever of the two is called first. They remain for the one thing they can express - reversing an axis - and this exists for the thing they cannot.
Throws std::invalid_argument unless the pair is orthonormal, and commits nothing when it does.
point_0 · point_1 · point_2 · point_3
Section titled “point_0 · point_1 · point_2 · point_3”Point2F point_0() const;Point2F point_1() const;Point2F point_2() const;Point2F point_3() const;points
Section titled “points”const std::array<Point2F, 4>& points() const;The four corners, in the order point_0..point_3 name them. A reference to storage the rectangle already holds, recomputed only when something that defines it changes.
edge_0 · edge_1 · edge_2 · edge_3
Section titled “edge_0 · edge_1 · edge_2 · edge_3”Segment edge_1() const;Segment edge_2() const;Segment edge_3() const;rectangle_rotated_to_axis
Section titled “rectangle_rotated_to_axis”float angle() const;is_valid
Section titled “is_valid”bool is_valid() const;operator== · operator!=
Section titled “operator== · operator!=”bool operator!=(const RectangleRotated& other) const;Related types
Section titled “Related types”Named in the public declarations above: Quad, RectangleF, Segment, Shape, ShapeType, Vector2F.
In the samples and tests
Section titled “In the samples and tests”The files that include this header directly. A file can also reach it through another header.
samples/components/shape_outline.cpp,shape_outline_null_tests.cpp,shape_outline_tests.cpptests/collision/contacts_tests.cpp,finite_shape_tests.cpp,narrow_phase_tests.cpptests/math/ericson_math_tests.cpp,rectangle_rotated_tests.cpp,shape_intersect_tests.cpp,shape_tests.cpptests/render/draw_object_tests.cpp
Explained in
Section titled “Explained in”Documentation for Labrador v0.4.0. Built from Labrador f525bc6 of 2026-11-17.