RectangleF
Generated from engine/math/rectanglef.h at aceb130. 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/rectanglef.h" · namespace labrador
struct RectangleF
Section titled “struct RectangleF”float x = 0.0f;float y = 0.0f;float width = 0.0f;height
Section titled “height”float height = 0.0f;RectangleF · operator=
Section titled “RectangleF · operator=”RectangleF(const RectangleF&) = default;RectangleF& operator=(const RectangleF&) = default;RectangleF
Section titled “RectangleF” const Vector2F& size);RectangleF(const Vector2F& center, float half_width, float 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
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”Vector2F position() const;Vector2F size() const;float left() const;float right() const;float top() const;float bottom() const;Vector2F top_left() const;Vector2F bottom_right() const;Vector2F top_right() const;Vector2F bottom_left() const;Segment bottom_edge() const;Segment left_edge() const;Segment right_edge() const;std::array<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_size · set_width · set_height
Section titled “inflate · offset · scale · set_position · set_position_at_center · 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 Vector2F& amount) override;void scale(float horizontal_amount, float vertical_amount);void scale(const Vector2F& amount);void set_position(const Vector2F& position);void set_position(float x, float y);void set_position_at_center(const Vector2F& position);void set_position_at_center(float x, float y);void set_size(const 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.
Related types
Section titled “Related types”Named in the public declarations above: 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/components/animation_preview.h,animation_preview_null_tests.cpp,gallery_binding_tests.cpp,gallery_pointer_tests.cpp,gallery_state.cpp,gallery_text_tests.cpp,nine_slice.h,nine_slice_tests.cpp,option_row_tests.cpp,shape_outline.cpp,shape_outline_tests.cpp,slider.h,slider_tests.cpp,touch_button.h,touch_stick.h,widget_draw_null_tests.cppsamples/linesweeper/presentation/arrangement.h,board_view.h,layout.h,particles.h,top_out_banner.h,touch_controls.hsamples/linesweeper/states/pause_state.cpp,play_state.cppsamples/local_multiplayer/follow_camera.hsamples/minimal/states/hello_state.cpptests/assets/grid_sheet_loader_tests.cpp,sprite_sheet_resource_tests.cpp,string_table_text_tests.cpptests/collision/broad_phase_tests.cpp,contacts_tests.cpp,finite_shape_tests.cpp,frame_allocation_tests.cpp,narrow_phase_tests.cpp,stub_collider.h,tunnelling_tests.cpptests/linesweeper/frame_allocation_tests.cpp,text_alignment_tests.cpp,top_out_banner_tests.cpp,touch_controls_tests.cpp,touch_pause_tests.cpptests/local_multiplayer/follow_camera_tests.cpptests/math/constant_initialisation_tests.cpp,ericson_math_tests.cpp,integer_geometry_tests.cpp,rectanglef_tests.cpp,shape_intersect_tests.cpp,shape_tests.cpptests/render/camera_tests.cpp,label_tests.cpp,null_resource_tests.cpp,null_tests.cpp,page_crossing_frame.h,pixel_tests.cpp,post_effect_tests.cpp,post_pixel_tests.cpp,presentation_lifecycle_tests.cpp,resource_pixel_tests.cpp,sprite_geometry_tests.cpp,sprite_pixel_tests.cpp,text_alignment_tests.cpp,view_pixel_tests.cpp,viewport_manager_tests.cpp,viewport_tests.cpp,visual_tests.cpptests/render/d3d12/submit_allocation_tests.cpp,texture_replacement_tests.cpptests/render/vulkan/submit_allocation_tests.cpp,submit_failure_tests.cpptests/render/web/context_loss_tests.cpptests/scene/cull_tests.cpp,fanout_tests.cpp,order_tests.cpp,scene_tests.cpp,tick_allocation_tests.cpptests/ui/navigation_tests.cpp,stub_widget.h,text_widget_tests.cpp
Explained in
Section titled “Explained in”- Drawing, views and cameras
- What a game is to the engine
- Collision
- Local multiplayer
- Menus
- Update your code for a newer Labrador
- Settings and saves
- Sprites and text
- Test your game
- Animate a sprite sheet
- Put collision in your game
- Copy the components into your game
- Add a second level
- Make a title menu
- Put a picture in your game
- Add a rule and a test
- Add a screen to your game
- Colours, the window and the background
Development documentation (unreleased). Built from Labrador aceb130 of 2026-11-20.