Chipmunk  6.0.3
Chipmunk API Reference for Kobold2D developers
cpBB

Data Structures

struct  cpBB
 Chipmunk's axis-aligned 2D bounding box type. (left, bottom, right, top) More...

Functions

static cpBB cpBBNew (const cpFloat l, const cpFloat b, const cpFloat r, const cpFloat t)
 Convenience constructor for cpBB structs.
static cpBB cpBBNewForCircle (const cpVect p, const cpFloat r)
 Constructs a cpBB for a circle with the given position and radius.
static cpBool cpBBIntersects (const cpBB a, const cpBB b)
 Returns true if a and b intersect.
static cpBool cpBBContainsBB (const cpBB bb, const cpBB other)
 Returns true if other lies completely within bb.
static cpBool cpBBContainsVect (const cpBB bb, const cpVect v)
 Returns true if bb contains v.
static cpBB cpBBMerge (const cpBB a, const cpBB b)
 Returns a bounding box that holds both bounding boxes.
static cpBB cpBBExpand (const cpBB bb, const cpVect v)
 Returns a bounding box that holds both bb and v.
static cpFloat cpBBArea (cpBB bb)
 Returns the area of the bounding box.
static cpFloat cpBBMergedArea (cpBB a, cpBB b)
 Merges a and b and returns the area of the merged bounding box.
static cpFloat cpBBSegmentQuery (cpBB bb, cpVect a, cpVect b)
 Returns the fraction along the segment query the cpBB is hit. Returns INFINITY if it doesn't hit.
static cpBool cpBBIntersectsSegment (cpBB bb, cpVect a, cpVect b)
 Return true if the bounding box intersects the line segment with ends a and b.
cpVect cpBBClampVect (const cpBB bb, const cpVect v)
 Clamp a vector to a bounding box.
cpVect cpBBWrapVect (const cpBB bb, const cpVect v)
 Wrap a vector to a bounding box.

Detailed Description

Chipmunk's axis-aligned 2D bounding box type along with a few handy routines.


Function Documentation

static cpFloat cpBBArea ( cpBB  bb) [inline, static]

Returns the area of the bounding box.

cpVect cpBBClampVect ( const cpBB  bb,
const cpVect  v 
)

Clamp a vector to a bounding box.

static cpBool cpBBContainsBB ( const cpBB  bb,
const cpBB  other 
) [inline, static]

Returns true if other lies completely within bb.

static cpBool cpBBContainsVect ( const cpBB  bb,
const cpVect  v 
) [inline, static]

Returns true if bb contains v.

static cpBB cpBBExpand ( const cpBB  bb,
const cpVect  v 
) [inline, static]

Returns a bounding box that holds both bb and v.

static cpBool cpBBIntersects ( const cpBB  a,
const cpBB  b 
) [inline, static]

Returns true if a and b intersect.

static cpBool cpBBIntersectsSegment ( cpBB  bb,
cpVect  a,
cpVect  b 
) [inline, static]

Return true if the bounding box intersects the line segment with ends a and b.

static cpBB cpBBMerge ( const cpBB  a,
const cpBB  b 
) [inline, static]

Returns a bounding box that holds both bounding boxes.

static cpFloat cpBBMergedArea ( cpBB  a,
cpBB  b 
) [inline, static]

Merges a and b and returns the area of the merged bounding box.

static cpBB cpBBNew ( const cpFloat  l,
const cpFloat  b,
const cpFloat  r,
const cpFloat  t 
) [inline, static]

Convenience constructor for cpBB structs.

static cpBB cpBBNewForCircle ( const cpVect  p,
const cpFloat  r 
) [inline, static]

Constructs a cpBB for a circle with the given position and radius.

static cpFloat cpBBSegmentQuery ( cpBB  bb,
cpVect  a,
cpVect  b 
) [inline, static]

Returns the fraction along the segment query the cpBB is hit. Returns INFINITY if it doesn't hit.

cpVect cpBBWrapVect ( const cpBB  bb,
const cpVect  v 
)

Wrap a vector to a bounding box.