Namespace MathAssertions.Geometry3D
Classes
- Containment
Containment predicates: which primitives lie wholly inside which others. Implemented as extension methods so call sites read naturally (
box.Contains(point),sphere.Contains(point)).
- Distance
Closest-point distance functions from a Vector3 to selected geometry primitives. Implemented as extension methods so call sites read naturally (
point.DistanceFrom(plane),point.DistanceFrom(segment)).
- Intersection
Boolean intersection predicates and parametric ray-intersection results for the MathAssertions.Geometry3D primitives plus Plane. Each ray-intersection pair offers both a boolean overload (for tests that only care whether the ray hits) and a parametric overload that exposes the hit-distance
talong the ray.
- Pointcloud
Aggregate predicates over a ReadOnlySpan<T> of Vector3: boundedness, centroid, and "approximately on a known surface" checks. Each helper is an extension method for natural call-site syntax (
cloud.IsBoundedBy(box),cloud.HasCentroidAt(expected, tolerance)).
- Properties
Geometric-property predicates over MathAssertions.Geometry3D primitives and point sets: triangle degeneracy, point-set collinearity, and point-set coplanarity.
Structs
- AxisAlignedBox
Axis-aligned bounding box (AABB) defined by minimum and maximum corners. The box is well-formed when
Min <= Maxcomponent-wise; the computed properties remain well-defined for inverted boxes (Sizecomponents turn negative,Volumebecomes signed) but containment and intersection methods on inverted boxes return undefined results. Callers are responsible for constructing valid boxes.
- Capsule
Capsule defined by two axis endpoints and a radius. Geometrically, the capsule is the set of points within Radius of the line segment from Start to End: a cylinder of length
|End - Start|with hemispherical caps.
- Cylinder
Finite cylinder defined by two axis endpoints and a radius. Distinct from Capsule: the cylinder's caps are flat disks, not hemispheres.
- OrientedBox
Oriented bounding box (OBB), defined by a center, three half-extents along the box's local axes, and a quaternion rotation that maps local-axis space to world space. The half-extents are the distances from the center to the box face along each local axis; negative half-extents are accepted but produce undefined containment results.
- Ray3D
Half-line in 3-space starting at Origin and extending along Direction. The direction is intended to be a unit vector but is not validated; non-unit directions parameterize the same geometric ray with rescaled
tvalues from intersection methods.
- Sphere
Sphere defined by center and radius. The radius is intended to be non-negative; the computed properties remain well-defined as polynomials in the radius for negative values, but the verdict is signed for Volume (the cubic in the radius flips sign) and unsigned for SurfaceArea (the quadratic in the radius is always non-negative). Validation of the radius is left to the caller.
- Triangle3D
Triangle defined by three vertices in 3-space. Vertex order determines the orientation of the surface normal (right-hand rule on
(B - A) x (C - A)).