Skip to main content

Module geometry_primitives

Module geometry_primitives 

Source
Expand description

Low-level geometry primitives: Ray, AABB, Sphere, Plane, Triangle, Capsule, OrientedBox, Frustum, convex polyhedron, and barycentric coordinates.

Structs§

Aabb3
Axis-aligned bounding box in 3D.
BarycentricCoords
Barycentric coordinate utilities.
Capsule3
A 3D capsule: a swept sphere along a line segment.
Frustum
A view frustum defined by 6 planes: near, far, left, right, top, bottom.
OrientedBox
An oriented bounding box (OBB) defined by center, local axes, and half-extents.
Plane3
An infinite plane in 3D: n·x = d.
PolyhedronConvex
A convex polyhedron defined by vertices and face normals.
Ray3
A 3D ray with origin and (pre-normalized) direction.
Sphere3
A sphere in 3D defined by center and radius.
Triangle3
A 3D triangle with three vertices.

Functions§

aabb_from_points
Build an AABB from a collection of points.
closest_point_segment
Find the closest point on a line segment (a → b) to point p.
closest_point_triangle
Find the closest point on a triangle to an external point p.
frustum_from_vp
Build a frustum from a combined view-projection matrix (row-major, 4×4). Extracts the 6 Gribb-Hartmann planes.