Skip to content

Intersection tests

Generated from engine/math/intersects.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.

Browse the math module

#include "engine/math/intersects.h" · namespace mattmath

The pairwise intersection vocabulary: every shape in this module against every other, as free functions.

EVERY ONE OF THESE BELONGS HERE, AT WHATEVER CALL COUNT. The count of callers is not the question; what a game does when it needs one of these is. A 2D engine whose client has to ask whether a segment crosses a rotated rectangle, and write the answer itself, has pushed geometry across the boundary (PHILOSOPHY, The boundary) - the game would be supplying mechanism, and a second definition of engine arithmetic would live outside the engine's tests, where the degenerate cases are not checked. Every one of these is a predicate a 2D game can reasonably want.

The collision module does not call these. narrow_phase measures a pair - an axis and a depth - rather than answering yes or no, and builds its own polygons and runs its own separating-axis test to do it.

No rectangles_intersect here: RectangleF::intersects(const RectangleF&) is that predicate.

const mattmath::Circle& circle, mattmath::Point2F& point);
const mattmath::Quad& quad);
const mattmath::Point2F& point);
const mattmath::Circle& b);
const mattmath::Triangle& triangle, mattmath::Point2F& point);
const mattmath::Triangle& triangle);
const mattmath::Quad& quad);
const mattmath::Segment& segment, mattmath::Point2F& point);
const mattmath::Segment& segment);
const mattmath::Point2F& point);
const mattmath::Triangle& b);
const mattmath::Quad& quad);
const mattmath::Segment& segment);
const mattmath::Point2F& point);
bool quads_intersect(const mattmath::Quad& a, const mattmath::Quad& b);
const mattmath::Segment& segment);
const mattmath::Point2F& point);
bool segments_intersect(const mattmath::Segment& a, const mattmath::Segment& b,
float& t, mattmath::Point2F& p);
bool segments_intersect(const mattmath::Segment& a, const mattmath::Segment& b);
bool point_rectangle_rotated_intersect(const mattmath::Point2F& point,
const mattmath::RectangleRotated& rect_rotated);
const mattmath::RectangleRotated& b);

Named in the public declarations above: Circle, Quad, RectangleF, RectangleRotated, Segment, Triangle.

The files that include this header directly. A file can also reach it through another header.

Development documentation (unreleased). Built from Labrador 862e08b of 2026-10-08.