std/geometry
The shapes, and what they answer about each other: what contains a point, what two of them share, how far apart they are, and which axis-aligned box holds one.
Every shape is generic over its scalar in the same way std/linear's vectors are. A Rectangle<Int> is the pixel or
tile rectangle and a Rectangle is the continuous one; the tests that need a square root or an angle live under
Real, and everything else works with whole numbers.
The package is pure value arithmetic: it knows about vectors and about nothing else.
Modules
std/geometry/box[Box], the axis-aligned box in space: what a bounding volume hierarchy is built out of, and the three-dimensional half-open shape.std/geometry/circle[Circle], the disc in the plane: the shape a broad-phase test is cheapest against, because the test is one subtraction, one dot product and one comparison.std/geometry/plane[Plane], the flat surface in space, held as a normal and a distance: what a frustum, a ground and a clipping surface all are.std/geometry/polygon[Polygon], a closed chain of corners in the plane, with the convex tests written first: a convex polygon is what a collision narrow phase, a view frustum in the plane and a navigation cell all are.std/geometry/ray2[Ray2], the half-line in the plane, and the hit tests written against it: the shape a pick, a line of sight and a one-step sweep are all asked in terms of.std/geometry/ray3[Ray3], the half-line in space, and the hit tests written against it: a pick, a line of sight, a shot, a shadow.std/geometry/rectangle[Rectangle], the axis-aligned box in the plane, and the one place where the half-open rule of this package is decided.std/geometry/segment2[Segment2], the straight piece of line between two points in the plane: an edge of a polygon, a wall, a swept step.std/geometry/sphere[Sphere], the ball in space: the bounding volume whose overlap test is one subtraction, one dot product and one comparison, and which a rotation does not change at all.std/geometry/triangle2[Triangle2], the triangle in the plane: the smallest shape that has an inside, and the one every mesh and every tessellation is made of.std/geometry/triangle3[Triangle3], the triangle in space: one face of a mesh, and what a ray is tested against once the broad phase has narrowed the search.
Everything
- type
BoxAn axis-aligned box: where it starts, and how big it is. - extend
Box<Scalar>What a sign buys: the distance to a point, along the axes. - extend
Box<Scalar>What a root and a halving buy: the midpoint and the euclidean distance. - type
CircleA disc: a midpoint and a radius. - type
PlaneA flat surface, as the direction that points away from it and how far along that direction it lies. - type
PolygonA closed chain of corners: the last one is joined back to the first, and there is no repeated corner at the end. - extend
Polygon<Scalar>What a sign buys: the area without its sign. - extend
Polygon<Scalar>What a halving buys: the area itself. - type
Ray2A half-line: where it starts and which way it points. - type
Ray3A half-line in space: where it starts and which way it points. - type
RectangleAn axis-aligned rectangle: where it starts, and how big it is. - extend
Rectangle<Scalar>What a sign buys: the distance to a point, measured along the axes. - extend
Rectangle<Scalar>What a root and a halving buy: the midpoint, a rectangle written from one, and the euclidean distance. - type
Segment2A straight piece of line, from one point to another. - extend
Segment2<Scalar>What a sign buys: the length along the axes. - extend
Segment2<Scalar>What a root buys: lengths, the nearest point and the crossing point. - type
SphereA ball: a midpoint and a radius. - type
Triangle2Three corners in the plane. - extend
Triangle2<Scalar>What a sign buys: the area without its sign. - extend
Triangle2<Scalar>What a halving and a root buy: the area, the midpoint and the nearest point. - type
Triangle3Three corners in space. - extend
Triangle3<Scalar>What a root and a halving buy: the normal, the area, the plane and the nearest point.