Scalars and tolerance
Generated from engine/math/scalar.h at 0f4f503. 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/scalar.h" · namespace labrador
pi · pi_over_2
Section titled “pi · pi_over_2”constexpr float pi = 3.14159265358979323846f;constexpr float pi_over_2 = pi / 2.0f;Engine angles use radians, including Vector2F::unit_vec_from_angle and RectangleRotated::angle.
default_epsilon
Section titled “default_epsilon”constexpr float default_epsilon = 0.0001f;General absolute comparison tolerance. It does not scale with coordinate magnitude: at 5000, one float step is about 4.883e-4, so adding this tolerance rounds back to 5000. Choose a tolerance for the quantity and coordinate range being compared; increasing this constant changes every caller using its default.
Related thresholds serve different purposes: - ericson_math.cpp's segment_parallel_epsilon (1e-6) expands a segment's slab test near parallel axes. - resolve.cpp's require_unit bound (1e-3) checks squared length and refuses non-unit input instead of correcting geometry. - resolve.h's min_axis_alignment (0.1) bounds the permitted separation direction; it is not a rounding tolerance. - RectangleRotated::edges_valid scales this tolerance by max(1, length) when comparing opposite-edge lengths. - inflate_convex_polygon uses this tolerance in a mitre solve whose branch affects produced vertices; it is not a collision query.
Takes the min branch first, so with a floor above the ceiling a value below the floor gets the floor and any other value gets the ceiling. Callers wanting one bound to win for an inverted range have to say so themselves.
are_equal
Section titled “are_equal” float epsilon = default_epsilon);Strict absolute comparison: abs(a - b) < epsilon. The vector overload applies it to both components. A nonpositive epsilon matches nothing; NaN differences do not compare equal.
Linear interpolation without clamping t; values outside [0, 1] extrapolate beyond the endpoints.
Related types
Section titled “Related types”Named in the public declarations above: 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/sound_board.cpptests/math/ericson_math_tests.cpp,matrix3x2f_tests.cpp,rectangle_rotated_tests.cpp,shape_intersect_tests.cpp,triangle_tests.cpp,vector2_tests.cpp
Explained in
Section titled “Explained in”Documentation for Labrador v0.3.0. Built from Labrador 0f4f503 of 2026-11-03.