HMath.Geometry¶
Module index · Numerical conventions
Description
Checked Cartesian geometry and bounded CPU reference algorithms.
Coordinates are finite with absolute value <=1e50; ND dimensions are 1..16.
Raw primitive constructors are convenient for pattern matching, so every
checked operation revalidates its inputs. Boundaries are included unless an
API returns an explicit Location. Two-dimensional positive orientation is
counterclockwise; three-dimensional coordinates are right-handed.
Polygon Boolean output rings preserve hole orientation. Constrained Delaunay constraints are noncrossing edges, not a polygon-domain/hole specification. Spatial queries expose exact/budget-exhaustion status. Collision support APIs operate on planar convex hulls; camera transforms follow OpenGL depth rules. Each algorithm documents its finite reference budget in the defining module.
On this page¶
| API | Purpose |
|---|---|
| Point2 | Cartesian two-dimensional point, also used for vectors. |
| P2 | Declaration and type contract below. |
| Point3 | Cartesian right-handed three-dimensional point/vector. |
| P3 | Declaration and type contract below. |
| PointND | A point of dimension 1..16. |
| PointND | Declaration and type contract below. |
| point2 | Given x,y, construct Point2 after bounded finite-coordinate validation. |
| point3 | Given x,y,z, construct Point3 after bounded finite-coordinate validation. |
| pointND | Construct a checked ND point from 1..16 bounded finite coordinates. |
| Line | Parametric line origin+t*direction; direction must be nonzero. |
| Line | Declaration and type contract below. |
| Ray | Parametric ray origin+t*direction, t>=0. |
| Ray | Declaration and type contract below. |
| Segment | Closed segment with two endpoints; zero length is valid. |
| Segment | Declaration and type contract below. |
| Plane | Plane normal dot x = offset, with a nonzero normal. |
| Plane | Declaration and type contract below. |
| Triangle | Closed triangle; zero-area triangles are rejected by triangle operations. |
| Triangle | Declaration and type contract below. |
| Rectangle | Axis-aligned rectangle with ordered corners. |
| Rectangle | Declaration and type contract below. |
| Circle | Circle with nonnegative radius. |
| Circle | Declaration and type contract below. |
| Ellipse | Rotated ellipse: positive semiaxes, counterclockwise angle in radians. |
| Ellipse | Declaration and type contract below. |
| Polygon | Simple polygon; vertices are implicitly closed and no duplicate endpoint is needed. |
| Polygon | Declaration and type contract below. |
| Sphere | Closed sphere, including a zero radius. |
| Sphere | Declaration and type contract below. |
| AABB | Ordered, closed axis-aligned bounds in 1..16 dimensions. |
| AABB | Declaration and type contract below. |
| OBB | Oriented three-dimensional box: center, three orthonormal axes, half-extents. |
| OBB | Declaration and type contract below. |
| Capsule | Capsule around the closed axis segment. |
| Capsule | Declaration and type contract below. |
| Cylinder | Finite cylinder with endpoint centers and radius; endpoints must differ. |
| Cylinder | Declaration and type contract below. |
| Cone | Finite cone with apex, base center, and radius; axis must be nonzero. |
| Cone | Declaration and type contract below. |
| Frustum | Convex frustum represented by six inward half-spaces n dot x >= offset. |
| Frustum | Declaration and type contract below. |
| Orientation | Sign of an exact predicate on the input Double values. |
| Clockwise | Declaration and type contract below. |
| Collinear | Declaration and type contract below. |
| Counterclockwise | Declaration and type contract below. |
| Location | Point position with boundary reported separately. |
| Outside | Declaration and type contract below. |
| Boundary | Declaration and type contract below. |
| Inside | Declaration and type contract below. |
Documentation
Point2
Cartesian two-dimensional point, also used for vectors.
Point3
Cartesian right-handed three-dimensional point/vector.
PointND
A point of dimension 1..16.
point2
point2 :: Double -> Double -> Either MathError Point2 Source #
Given x,y, construct Point2 after bounded finite-coordinate validation. Invalid values return DomainError.
point3
point3 :: Double -> Double -> Double -> Either MathError Point3 Source #
Given x,y,z, construct Point3 after bounded finite-coordinate validation. Invalid values return DomainError.
pointND
pointND :: [Double] -> Either MathError PointND Source #
Construct a checked ND point from 1..16 bounded finite coordinates. Invalid dimension/value returns DomainError.
Line
Parametric line origin+t*direction; direction must be nonzero.
Ray
Parametric ray origin+t*direction, t>=0.
Segment
Closed segment with two endpoints; zero length is valid.
Instances
Plane
Plane normal dot x = offset, with a nonzero normal.
Triangle
Closed triangle; zero-area triangles are rejected by triangle operations.
Rectangle
Axis-aligned rectangle with ordered corners.
Circle
Circle with nonnegative radius.
Ellipse
Rotated ellipse: positive semiaxes, counterclockwise angle in radians.
Instances
Polygon
Simple polygon; vertices are implicitly closed and no duplicate endpoint is needed.
Instances
Sphere
Closed sphere, including a zero radius.
AABB
Ordered, closed axis-aligned bounds in 1..16 dimensions.
OBB
Oriented three-dimensional box: center, three orthonormal axes, half-extents.
Capsule
Capsule around the closed axis segment.
Instances
Cylinder
Finite cylinder with endpoint centers and radius; endpoints must differ.
Cone
Finite cone with apex, base center, and radius; axis must be nonzero.
Frustum
Convex frustum represented by six inward half-spaces n dot x >= offset.
Instances
Orientation
data Orientation Source #
Sign of an exact predicate on the input Double values.
Constructors
| Clockwise | |
| Collinear | |
| Counterclockwise |
Instances
| Show Orientation Source # | |
Defined in HMath.Geometry.Internal Methods showsPrec :: Int -> Orientation -> ShowS # show :: Orientation -> String # showList :: [Orientation] -> ShowS # | |
| Eq Orientation Source # | |
Defined in HMath.Geometry.Internal | |
| Ord Orientation Source # | |
Defined in HMath.Geometry.Internal Methods compare :: Orientation -> Orientation -> Ordering # (<) :: Orientation -> Orientation -> Bool # (<=) :: Orientation -> Orientation -> Bool # (>) :: Orientation -> Orientation -> Bool # (>=) :: Orientation -> Orientation -> Bool # max :: Orientation -> Orientation -> Orientation # min :: Orientation -> Orientation -> Orientation # | |
Location
Point position with boundary reported separately.
module HMath.Geometry.Primitives
module HMath.Geometry.Polygon
module HMath.Geometry.Triangulation
module HMath.Geometry.Spatial
module HMath.Geometry.Collision
module HMath.Geometry.Transform