Skip to content

Quad

Generated from engine/math/quad.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/quad.h" · namespace labrador

struct Quad : public Shape

A convex quadrilateral: four points in order around it, either winding and from any start, so long as the diagonals properly cross (is_valid). The RectangleF form lists the top left, top right, bottom right and bottom left corners.

Quad() = default;
Quad(const Quad&) = default;
Quad& operator=(const Quad&) = default;
Quad(const Vector2F& point_0, const Vector2F& point_1,
const Vector2F& point_2, const Vector2F& point_3);
explicit Quad(const RectangleF& rectangle);
explicit Quad(const RectangleRotated& rectangle);

Explicit, because a rectangle is not a Quad and both forms throw on a degenerate one: an implicit conversion would become a runtime exception from inside the callee with no conversion visible at the call site.

bounding_box · shape_type · offset · inflate

Section titled “bounding_box · shape_type · offset · inflate”
RectangleF bounding_box() const override;
ShapeType shape_type() const override;
void offset(const Vector2F& amount) override;
void inflate(float amount) override;
bool is_valid() const;

point_0 · point_1 · point_2 · point_3 · set_point_0 · set_point_1 · set_point_2 · set_point_3

Section titled “point_0 · point_1 · point_2 · point_3 · set_point_0 · set_point_1 · set_point_2 · set_point_3”
const Point2F& point_0() const;
const Point2F& point_1() const;
const Point2F& point_2() const;
const Point2F& point_3() const;
void set_point_0(const Point2F& point);
void set_point_1(const Point2F& point);
void set_point_2(const Point2F& point);
void set_point_3(const Point2F& point);
const std::array<Point2F, 4>& points() const;

The four points, in the order point_0..point_3 name them.

edge_0 · edge_1 · edge_2 · edge_3 · edges

Section titled “edge_0 · edge_1 · edge_2 · edge_3 · edges”
Segment edge_0() const;
Segment edge_1() const;
Segment edge_2() const;
Segment edge_3() const;
std::array<Segment, 4> edges() const;
std::array<Triangle, 2> triangles() const;

Split along the diagonal from point 0 to point 2: (0, 1, 2) and (0, 2, 3).

bool operator==(const Quad& other) const;
bool operator!=(const Quad& other) const;
Vector2F center() const override;

Named in the public declarations above: RectangleF, RectangleRotated, Segment, Shape, ShapeType, Triangle, Vector2F.

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

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

All documentation versions