Skip to content

HMath.Geometry.Collision

Module index · Numerical conventions

Description

Bounded two-dimensional convex collision reference algorithms. Inputs are finite point sets whose convex hulls are the shapes. GJK uses support mapping and simplex reduction; EPA expands a support polytope for penetration; SAT tests every polygon edge normal. Touching counts as collision. Caller iteration budgets prevent unbounded work; EPA reports an estimated support-gap error, not a formal floating-point error bound. Curved 3D primitives have separate exact signed-distance APIs.

On this page

API Purpose
gjk Convex intersection by Gilbert-Johnson-Keerthi support/simplex iterations.
Penetration Normal moves the second shape away from the first by penetrationDepth.
Penetration Declaration and type contract below.
penetrationDepth Estimated overlap depth along penetrationNormal, in coordinate units.
penetrationNormal Separating direction of the returned EPA penetration estimate.
penetrationError Remaining absolute support gap at the stopping iteration.
penetrationIterations Completed expanding-polytope iterations.
epa Expanding polytope penetration estimate.
separatingAxis Separating-axis collision and minimum overlap for convex polygons.

Documentation

gjk

gjk :: Int -> [Point2] -> [Point2] -> Either MathError Bool Source #

Convex intersection by Gilbert-Johnson-Keerthi support/simplex iterations.

Penetration

data Penetration Source #

Normal moves the second shape away from the first by penetrationDepth. A zero-depth touch may have the deterministic normal (1,0).

Constructors

Penetration 

Fields

Instances

Instances details
Show Penetration Source # 
Instance details

Defined in HMath.Geometry.Collision

Eq Penetration Source # 
Instance details

Defined in HMath.Geometry.Collision

epa

epa :: Int -> Double -> [Point2] -> [Point2] -> Either MathError (Maybe Penetration) Source #

Expanding polytope penetration estimate. The tolerance is an absolute support-gap stopping threshold, positive finite and <=1e50.

separatingAxis

separatingAxis :: [Point2] -> [Point2] -> Either MathError (Maybe Penetration) Source #

Separating-axis collision and minimum overlap for convex polygons. Shapes must have nonzero area; containment depth uses the distance to the nearer separating interval endpoint, rather than only the interval intersection.