RectangleF
Generated from engine/math/rectanglef.h at 862e08b. The text under each declaration is the header's own comment, word for word. About the reference says how these pages are made.
#include "engine/math/rectanglef.h" · namespace mattmath
struct RectangleF
Section titled “struct RectangleF”x · y · width · height
Section titled “x · y · width · height”float x = 0.0f;float y = 0.0f;float width = 0.0f;float height = 0.0f;RectangleF
Section titled “RectangleF”RectangleF(const RectangleF&) = default;RectangleF
Section titled “RectangleF” const mattmath::Vector2F& size);RectangleF(const mattmath::Vector2F& center, float horiz_half_width, float vert_half_height);constexpr and defined here so ZERO is constant-initialised. See Vector2F's constants for what the dynamic alternative risks.
bounding_box · shape_type
Section titled “bounding_box · shape_type”center · position · size · left · right · top · bottom · top_left · bottom_right · top_right · bottom_left · top_edge · bottom_edge · left_edge · right_edge · edges · rectangle_i
Section titled “center · position · size · left · right · top · bottom · top_left · bottom_right · top_right · bottom_left · top_edge · bottom_edge · left_edge · right_edge · edges · rectangle_i”mattmath::Vector2F position() const;mattmath::Vector2F size() const;float left() const;float right() const;float top() const;float bottom() const;mattmath::Vector2F top_left() const;mattmath::Vector2F bottom_right() const;mattmath::Vector2F top_right() const;mattmath::Vector2F bottom_left() const;mattmath::Segment bottom_edge() const;mattmath::Segment left_edge() const;mattmath::Segment right_edge() const;std::array<mattmath::Segment, 4> edges() const;operator== · operator!=
Section titled “operator== · operator!=”bool operator!=(const RectangleF& other) const;contains
Section titled “contains”intersects
Section titled “intersects”The one member predicate, because box against box is what the broad phase and the scene's view cull ask. Every other pair is a free predicate in intersects.h (shape.h says why there is no virtual table over them).
inflate · offset · scale · set_position · set_position_at_center · set_position_x · set_position_x_from_right · set_position_y · set_position_y_from_bottom · set_position_from_top_right · set_position_from_bottom_left · set_position_from_bottom_right · set_size · set_width · set_height
Section titled “inflate · offset · scale · set_position · set_position_at_center · set_position_x · set_position_x_from_right · set_position_y · set_position_y_from_bottom · set_position_from_top_right · set_position_from_bottom_left · set_position_from_bottom_right · set_size · set_width · set_height”void inflate(float horizontal_amount, float vertical_amount);void inflate(float amount) override;void offset(float horizontal_amount, float vertical_amount);void offset(const mattmath::Vector2F& amount) override;void scale(float horizontal_amount, float vertical_amount);void scale(const mattmath::Vector2F& amount);void set_position(const mattmath::Vector2F& position);void set_position(float x, float y);void set_position_at_center(const mattmath::Vector2F& position);void set_position_at_center(float x, float y);void set_position_x(float x);void set_position_x_from_right(float x);void set_position_y(float y);void set_position_y_from_bottom(float y);void set_position_from_top_right(const mattmath::Vector2F& position);void set_position_from_top_right(float x, float y);void set_position_from_bottom_left(const mattmath::Vector2F& position);void set_position_from_bottom_left(float x, float y);void set_position_from_bottom_right(const mattmath::Vector2F& position);void set_position_from_bottom_right(float x, float y);void set_size(const mattmath::Vector2F& size);void set_size(float width, float height);void set_width(float width);void set_height(float height);union_of
Section titled “union_of”bounding_box_of
Section titled “bounding_box_of”The smallest axis-aligned box containing every point.
Triangle, Quad and RectangleRotated all take their bounding_box() from this. Empty in, ZERO out - a box around nothing.
A non-finite coordinate is NOT rejected. std::min(a, NaN) returns a, so a poisoned vertex is silently dropped rather than poisoning the box, and checking per coordinate would put an isnan on a path every broad-phase candidate walks. The predicates downstream are the ones written to survive a NaN (see test_AABB_AABB); this stays cheap.
from_top_left_bottom_right
Section titled “from_top_left_bottom_right” const mattmath::Vector2F& bottom_right);static RectangleF from_top_left_bottom_right(float top, float left, float bottom, float right);Related types
Section titled “Related types”Named in the public declarations above: RectangleI, 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/audio/audio_state.cppsamples/linesweeper/presentation/board_view.h,layout.h,particles.h,top_out_banner.hsamples/linesweeper/states/pause_state.cpp,play_state.cppsamples/minimal/states/hello_state.cpptests/collision/broad_phase_tests.cpp,contacts_tests.cpp,narrow_phase_tests.cpp,tunnelling_tests.cpptests/math/constant_initialisation_tests.cpp,ericson_math_tests.cpp,rectanglef_tests.cpp,shape_intersect_tests.cpp,shape_tests.cpptests/render/camera_tests.cpp,camera_tools_tests.cpp,label_tests.cpp,null_tests.cpp,pixel_tests.cpp,sprite_geometry_tests.cpp,text_drop_shadow_tests.cpp,viewport_manager_tests.cpp,viewport_tests.cpp,visual_tests.cpptests/scene/cull_tests.cpp,fanout_tests.cpp,scene_tests.cpptests/ui/navigation_tests.cpp,stub_widget.h
Development documentation (unreleased). Built from Labrador 862e08b of 2026-10-08.