Box3D
Safe HaskellNone
LanguageGHC2021

Box3D.MathTypes

Contents

Description

Low-level bindings to the value types in box3d/math_functions.h.

These are the small POD math structs that the Box3D API passes and returns by value. Field order matches the C layout; Storable offsets come straight from the header via hsc2hs. Fields are Float because C float maps to the Haskell FFI Float with an identical representation.

In single-precision builds (the default) b3Pos and b3WorldTransform are typedefs for b3Vec3 and b3Transform, so Pos and WorldTransform are type synonyms here.

Synopsis

Documentation

data Vec2 Source #

A 2D vector.

Constructors

Vec2 Float Float 

Instances

Instances details
Storable Vec2 Source # 
Instance details

Defined in Box3D.MathTypes

Methods

sizeOf :: Vec2 -> Int #

alignment :: Vec2 -> Int #

peekElemOff :: Ptr Vec2 -> Int -> IO Vec2 #

pokeElemOff :: Ptr Vec2 -> Int -> Vec2 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Vec2 #

pokeByteOff :: Ptr b -> Int -> Vec2 -> IO () #

peek :: Ptr Vec2 -> IO Vec2 #

poke :: Ptr Vec2 -> Vec2 -> IO () #

Show Vec2 Source # 
Instance details

Defined in Box3D.MathTypes

Methods

showsPrec :: Int -> Vec2 -> ShowS #

show :: Vec2 -> String #

showList :: [Vec2] -> ShowS #

Eq Vec2 Source # 
Instance details

Defined in Box3D.MathTypes

Methods

(==) :: Vec2 -> Vec2 -> Bool #

(/=) :: Vec2 -> Vec2 -> Bool #

data Vec3 Source #

A 3D vector.

Constructors

Vec3 Float Float Float 

Instances

Instances details
Storable Vec3 Source # 
Instance details

Defined in Box3D.MathTypes

Methods

sizeOf :: Vec3 -> Int #

alignment :: Vec3 -> Int #

peekElemOff :: Ptr Vec3 -> Int -> IO Vec3 #

pokeElemOff :: Ptr Vec3 -> Int -> Vec3 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Vec3 #

pokeByteOff :: Ptr b -> Int -> Vec3 -> IO () #

peek :: Ptr Vec3 -> IO Vec3 #

poke :: Ptr Vec3 -> Vec3 -> IO () #

Show Vec3 Source # 
Instance details

Defined in Box3D.MathTypes

Methods

showsPrec :: Int -> Vec3 -> ShowS #

show :: Vec3 -> String #

showList :: [Vec3] -> ShowS #

Eq Vec3 Source # 
Instance details

Defined in Box3D.MathTypes

Methods

(==) :: Vec3 -> Vec3 -> Bool #

(/=) :: Vec3 -> Vec3 -> Bool #

data CosSin Source #

Cosine and sine pair (cosine, sine).

Constructors

CosSin Float Float 

Instances

Instances details
Storable CosSin Source # 
Instance details

Defined in Box3D.MathTypes

Show CosSin Source # 
Instance details

Defined in Box3D.MathTypes

Eq CosSin Source # 
Instance details

Defined in Box3D.MathTypes

Methods

(==) :: CosSin -> CosSin -> Bool #

(/=) :: CosSin -> CosSin -> Bool #

data Quat Source #

A quaternion: vector part v and scalar part s.

Constructors

Quat Vec3 Float 

Instances

Instances details
Storable Quat Source # 
Instance details

Defined in Box3D.MathTypes

Methods

sizeOf :: Quat -> Int #

alignment :: Quat -> Int #

peekElemOff :: Ptr Quat -> Int -> IO Quat #

pokeElemOff :: Ptr Quat -> Int -> Quat -> IO () #

peekByteOff :: Ptr b -> Int -> IO Quat #

pokeByteOff :: Ptr b -> Int -> Quat -> IO () #

peek :: Ptr Quat -> IO Quat #

poke :: Ptr Quat -> Quat -> IO () #

Show Quat Source # 
Instance details

Defined in Box3D.MathTypes

Methods

showsPrec :: Int -> Quat -> ShowS #

show :: Quat -> String #

showList :: [Quat] -> ShowS #

Eq Quat Source # 
Instance details

Defined in Box3D.MathTypes

Methods

(==) :: Quat -> Quat -> Bool #

(/=) :: Quat -> Quat -> Bool #

data Transform Source #

A rigid transform: position p and rotation q.

Constructors

Transform Vec3 Quat 

Instances

Instances details
Storable Transform Source # 
Instance details

Defined in Box3D.MathTypes

Show Transform Source # 
Instance details

Defined in Box3D.MathTypes

Eq Transform Source # 
Instance details

Defined in Box3D.MathTypes

data Matrix3 Source #

A 3x3 column-major matrix (columns cx, cy, cz).

Constructors

Matrix3 Vec3 Vec3 Vec3 

Instances

Instances details
Storable Matrix3 Source # 
Instance details

Defined in Box3D.MathTypes

Show Matrix3 Source # 
Instance details

Defined in Box3D.MathTypes

Eq Matrix3 Source # 
Instance details

Defined in Box3D.MathTypes

Methods

(==) :: Matrix3 -> Matrix3 -> Bool #

(/=) :: Matrix3 -> Matrix3 -> Bool #

data AABB Source #

Axis-aligned bounding box (lowerBound, upperBound).

Constructors

AABB Vec3 Vec3 

Instances

Instances details
Storable AABB Source # 
Instance details

Defined in Box3D.MathTypes

Methods

sizeOf :: AABB -> Int #

alignment :: AABB -> Int #

peekElemOff :: Ptr AABB -> Int -> IO AABB #

pokeElemOff :: Ptr AABB -> Int -> AABB -> IO () #

peekByteOff :: Ptr b -> Int -> IO AABB #

pokeByteOff :: Ptr b -> Int -> AABB -> IO () #

peek :: Ptr AABB -> IO AABB #

poke :: Ptr AABB -> AABB -> IO () #

Show AABB Source # 
Instance details

Defined in Box3D.MathTypes

Methods

showsPrec :: Int -> AABB -> ShowS #

show :: AABB -> String #

showList :: [AABB] -> ShowS #

Eq AABB Source # 
Instance details

Defined in Box3D.MathTypes

Methods

(==) :: AABB -> AABB -> Bool #

(/=) :: AABB -> AABB -> Bool #

data Plane Source #

A plane: normal and offset where separation = dot(normal, point) - offset.

Constructors

Plane Vec3 Float 

Instances

Instances details
Storable Plane Source # 
Instance details

Defined in Box3D.MathTypes

Methods

sizeOf :: Plane -> Int #

alignment :: Plane -> Int #

peekElemOff :: Ptr Plane -> Int -> IO Plane #

pokeElemOff :: Ptr Plane -> Int -> Plane -> IO () #

peekByteOff :: Ptr b -> Int -> IO Plane #

pokeByteOff :: Ptr b -> Int -> Plane -> IO () #

peek :: Ptr Plane -> IO Plane #

poke :: Ptr Plane -> Plane -> IO () #

Show Plane Source # 
Instance details

Defined in Box3D.MathTypes

Methods

showsPrec :: Int -> Plane -> ShowS #

show :: Plane -> String #

showList :: [Plane] -> ShowS #

Eq Plane Source # 
Instance details

Defined in Box3D.MathTypes

Methods

(==) :: Plane -> Plane -> Bool #

(/=) :: Plane -> Plane -> Bool #

type Pos = Vec3 Source #

World position. In single-precision builds this is Vec3.

type WorldTransform = Transform Source #

World transform. In single-precision builds this is Transform.

Constants