Skip to content

Intersection tests

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

Browse the math module

Audience: game code.

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

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.

Every predicate taking a Circle answers false for a circle that is not Circle::is_valid - a nonfinite centre or radius, or a negative radius - and leaves its point out-parameter unchanged when it does. A zero radius is a point, and the boundary is inside.

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

bool rectangle_circle_intersect(const RectangleF& rectangle,
const Circle& circle, Point2F& point);
bool rectangle_circle_intersect(const RectangleF& rectangle,
const Circle& circle);
const Triangle& triangle);
bool rectangle_quad_intersect(const RectangleF& rectangle,
const Quad& quad);
const Segment& segment);
bool rectangle_point_intersect(const RectangleF& rectangle,
const Point2F& point);
const RectangleRotated& rectangle_rotated);
bool circles_intersect(const Circle& a,
const Circle& b);
bool circle_triangle_intersect(const Circle& circle,
const Triangle& triangle, Point2F& point);
bool circle_triangle_intersect(const Circle& circle,
const Triangle& triangle);
bool circle_quad_intersect(const Circle& circle,
const Quad& quad);
bool circle_segment_intersect(const Circle& circle,
const Segment& segment, Point2F& point);
bool circle_segment_intersect(const Circle& circle,
const Segment& segment);
bool circle_point_intersect(const Circle& circle,
const Point2F& point);
const RectangleRotated& rectangle_rotated);
const Triangle& b);
bool triangle_quad_intersect(const Triangle& triangle,
const Quad& quad);
bool triangle_segment_intersect(const Triangle& triangle,
const Segment& segment);
bool triangle_point_intersect(const Triangle& triangle,
const Point2F& point);
const RectangleRotated& rectangle_rotated);
bool quads_intersect(const Quad& a, const Quad& b);
bool quad_segment_intersect(const Quad& quad,
const Segment& segment);
bool quad_point_intersect(const Quad& quad,
const Point2F& point);
const RectangleRotated& rectangle_rotated);
bool segments_intersect(const Segment& a, const Segment& b,
float& t, Point2F& p);
bool segments_intersect(const Segment& a, const Segment& b);
const RectangleRotated& rectangle_rotated);
bool point_rectangle_rotated_intersect(const Point2F& point,
const RectangleRotated& rectangle_rotated);
const 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.

No guide or concept page links to this header yet.

Documentation for Labrador v0.4.0. Built from Labrador f525bc6 of 2026-11-17.

All documentation versions