Box2D
Safe HaskellNone
LanguageGHC2021

Box2D.MathFunctions

Description

Low-level bindings to the exported (non-inline) functions of box2d/math_functions.h.

Box2D implements most of its vector math as static inline helpers, which have no linkable symbols and are therefore out of scope for FFI. Only the handful of functions marked B2_API are bound here: the validators (handy as ABI oracles for the Box2D.MathTypes Storable instances) and a couple of by-value constructors.

Synopsis

Documentation

isValidVec2 :: Vec2 -> IO Bool Source #

Is this a valid (finite, non-NaN) vector?

isValidRotation :: Rot -> IO Bool Source #

Is this a valid, normalized rotation?

isValidTransform :: Transform -> IO Bool Source #

Is this a valid rigid transform?

isValidAABB :: AABB -> IO Bool Source #

Is this a valid, bounded AABB?

isValidPlane :: Plane -> IO Bool Source #

Is this a valid plane (finite, unit normal)?

computeCosSin :: Float -> IO CosSin Source #

Compute a deterministic cosine/sine pair for the given angle in radians.

makeRot :: Float -> IO Rot Source #

Make a normalized rotation from an angle in radians.

rotGetAngle :: Rot -> Float Source #

The angle of a rotation in radians, in (-pi, pi]; the inverse of makeRot. Pure (upstream b2Rot_GetAngle is an inline header function).