Skip to content

HMath.Geometry.Transform

Module index · Numerical conventions

Description

Column-vector homogeneous transforms. The 3D camera convention is right-handed, looks along negative camera z, and maps the visible depth range to OpenGL NDC [-1,1]. Positive y points up. Composition a*b applies b first. Affine ND transforms accept dimensions 1..16; projective 3D transforms reject points at infinity. Frustum normals point inward and culling retains tangency.

On this page

API Purpose
affineTransform Construct an affine matrix [linear,translation;0,1].
applyTransform Apply an affine or projective matrix and divide by homogeneous w.
composeTransforms Checked matrix composition; projective and affine matrices may be mixed.
inverseTransform Gauss-Jordan inverse with partial pivoting, bounded to matrices of size 17.
perspective Vertical field of view in (0,pi), positive aspect, 0<near<far.
orthographic Orthographic bounds with left<right, bottom<top and 0<=near<far.
lookAt World-to-camera transform from eye, target and nonparallel up direction.
extractFrustum Extract six inward clipping planes from projection*view.
cullSphere True means the closed sphere may be visible (conservative plane culling).
cullBox True means the closed 3D AABB may be visible; corners need not be allocated.

Documentation

affineTransform

affineTransform :: Matrix Double -> PointND -> Either MathError (Matrix Double) Source #

Construct an affine matrix [linear,translation;0,1].

applyTransform

applyTransform :: Matrix Double -> PointND -> Either MathError PointND Source #

Apply an affine or projective matrix and divide by homogeneous w.

composeTransforms

composeTransforms :: Matrix Double -> Matrix Double -> Either MathError (Matrix Double) Source #

Checked matrix composition; projective and affine matrices may be mixed.

inverseTransform

inverseTransform :: Matrix Double -> Either MathError (Matrix Double) Source #

Gauss-Jordan inverse with partial pivoting, bounded to matrices of size 17.

perspective

perspective :: Double -> Double -> Double -> Double -> Either MathError (Matrix Double) Source #

Vertical field of view in (0,pi), positive aspect, 0<near<far.

orthographic

orthographic :: Double -> Double -> Double -> Double -> Double -> Double -> Either MathError (Matrix Double) Source #

Orthographic bounds with left<right, bottom<top and 0<=near<far.

lookAt

lookAt :: Point3 -> Point3 -> Point3 -> Either MathError (Matrix Double) Source #

World-to-camera transform from eye, target and nonparallel up direction.

extractFrustum

extractFrustum :: Matrix Double -> Either MathError Frustum Source #

Extract six inward clipping planes from projection*view. Plane normals are normalized so signed plane values are distances in world coordinates.

cullSphere

cullSphere :: Frustum -> Sphere -> Either MathError Bool Source #

True means the closed sphere may be visible (conservative plane culling).

cullBox

cullBox :: Frustum -> AABB -> Either MathError Bool Source #

True means the closed 3D AABB may be visible; corners need not be allocated.