Skip to content

Triangle

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

struct Triangle : public Shape
Vector2F points[3] = { Vector2F::ZERO, Vector2F::ZERO, Vector2F::ZERO };
Triangle() = default;
Triangle(const Triangle&) = default;
Triangle(const mattmath::Vector2F& point0,
const mattmath::Vector2F& point1,
const mattmath::Vector2F& point2);
Triangle(float x0, float y0, float x1, float y1, float x2, float y2);

bounding_box · shape_type · offset · inflate

Section titled “bounding_box · shape_type · offset · inflate”
mattmath::RectangleF bounding_box() const override;
ShapeType shape_type() const override;
void offset(const mattmath::Vector2F& amount) override;
void inflate(float amount) override;
const Vector2F& point_0() const;
const Vector2F& point_1() const;
const Vector2F& point_2() const;
Segment edge_0() const;
Segment edge_1() const;
Segment edge_2() const;
std::array<Segment, 3> edges() const;
float angle_0() const;
float angle_1() const;
float angle_2() const;
bool operator==(const Triangle& other) const;
bool operator!=(const Triangle& other) const;
mattmath::Vector2F center() const override;
float calculate_gradient(int edge) const;
TriangleRightAxisAligned(const TriangleRightAxisAligned&) = default;
TriangleRightAxisAligned(const mattmath::Vector2F& top,
const mattmath::Vector2F& left, const mattmath::Vector2F& right);
TriangleRightAxisAligned(float x0, float y0, float x1, float y1,
float x2, float y2);
Segment hypotenuse() const;
float hypotenuse_gradient() const;

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

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.