shapes-0.1.0.0: physics engine and other tools for 2D shapes

Safe HaskellNone
LanguageHaskell2010

Physics.Broadphase.Aabb

Description

Aabb is "Axis-aligned bounding box". The "broadphase" of collision detection is a conservative estimate of which bodies may be in contact.

Synopsis

Documentation

data Bounds Source #

An interval, bounded above and below

Constructors

Bounds 

Fields

Instances

Eq Bounds Source # 

Methods

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

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

Generic Bounds Source # 

Associated Types

type Rep Bounds :: * -> * #

Methods

from :: Bounds -> Rep Bounds x #

to :: Rep Bounds x -> Bounds #

NFData Bounds Source # 

Methods

rnf :: Bounds -> () #

Unbox Bounds Source # 
Vector Vector Bounds Source # 
MVector MVector Bounds Source # 
type Rep Bounds Source # 
type Rep Bounds = D1 * (MetaData "Bounds" "Physics.Broadphase.Aabb" "shapes-0.1.0.0-E6UUiYRpOc15rGTlEn6KOE" False) (C1 * (MetaCons "Bounds" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "_bmin") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (UDouble *)) (S1 * (MetaSel (Just Symbol "_bmax") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (UDouble *))))
data Vector Bounds Source # 
data MVector s Bounds Source # 

data Aabb Source #

An axis-aligned bounding box (AABB)

Constructors

Aabb 

Fields

Instances

Eq Aabb Source # 

Methods

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

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

Show Aabb Source # 

Methods

showsPrec :: Int -> Aabb -> ShowS #

show :: Aabb -> String #

showList :: [Aabb] -> ShowS #

Generic Aabb Source # 

Associated Types

type Rep Aabb :: * -> * #

Methods

from :: Aabb -> Rep Aabb x #

to :: Rep Aabb x -> Aabb #

NFData Aabb Source # 

Methods

rnf :: Aabb -> () #

Unbox Aabb Source # 
Vector Vector Aabb Source # 
MVector MVector Aabb Source # 
type Rep Aabb Source # 
type Rep Aabb = D1 * (MetaData "Aabb" "Physics.Broadphase.Aabb" "shapes-0.1.0.0-E6UUiYRpOc15rGTlEn6KOE" False) (C1 * (MetaCons "Aabb" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "_aabbx") SourceUnpack SourceStrict DecidedStrict) (Rec0 * Bounds)) (S1 * (MetaSel (Just Symbol "_aabby") SourceUnpack SourceStrict DecidedStrict) (Rec0 * Bounds))))
data Vector Aabb Source # 
data MVector s Aabb Source # 

boundsOverlap :: Bounds -> Bounds -> Bool Source #

Do a pair of intervals overlap?

aabbCheck :: Aabb -> Aabb -> Bool Source #

Do a pair of AABBs overlap?

hullToAabb :: ConvexHull -> Aabb Source #

Find the AABB for a convex polygon.

toAabb_ :: P2 -> Aabb Source #

Get the (degenerate) AABB for a single point.

mergeAabb :: Aabb -> Aabb -> Aabb Source #

Find the AABB of a pair of AABBs.

mergeRange :: Bounds -> Bounds -> Bounds Source #

Find the interval that contains a pair of intervals.

toAabbs :: (Unbox k, PhysicsWorld k w o) => w -> Vector (k, Aabb) Source #

Find the AABB for each object in a world.

Build a vector of these AABBs, each identified by its key in the world.

Objects are ordered using the world's traversal order

toTaggedAabbs :: (Unbox k, Unbox tag, PhysicsWorld k w o) => (o -> tag) -> w -> Vector (k, Aabb, tag) Source #

Given a world:

  • Find the AABB for each object.
  • Extract a tag from each object.
  • Build a vector of these tagged AABBs, each identified by its key in the world.

Objects are ordered using the world's traversal order

unorderedPairs :: Int -> [(Int, Int)] Source #

Called "unordered" because (x, y) is equivalent to (y, x)

Given an Int n, find all choices of two different Ints [0, n - 1]

These pairs (x, y) are in decreasing order, where x is the most significant value and y is the least significant value.

culledKeys :: (Unbox k, PhysicsWorld k w o, WorldObj a ~ o) => w -> Descending (k, k) Source #

Find pairs of objects with overlapping AABBs. Note: Pairs of static objects are excluded. These pairs are in descending order according to unorderedPairs, where "ascending" is the world's traversal order.