Defines | Functions | Variables

Misc

Defines

#define CP_BUFFER_BYTES   (32*1024)
 Allocated size for various Chipmunk buffers.
#define cpcalloc   calloc
 Chipmunk calloc() alias.
#define cprealloc   realloc
 Chipmunk realloc() alias.
#define cpfree   free
 Chipmunk free() alias.

Functions

void cpInitChipmunk (void)
cpFloat cpMomentForCircle (cpFloat m, cpFloat r1, cpFloat r2, cpVect offset)
 Calculate the moment of inertia for a circle.
cpFloat cpAreaForCircle (cpFloat r1, cpFloat r2)
 Calculate area of a hollow circle.
cpFloat cpMomentForSegment (cpFloat m, cpVect a, cpVect b)
 Calculate the moment of inertia for a line segment.
cpFloat cpAreaForSegment (cpVect a, cpVect b, cpFloat r)
 Calculate the area of a fattened (capsule shaped) line segment.
cpFloat cpMomentForPoly (cpFloat m, int numVerts, const cpVect *verts, cpVect offset)
 Calculate the moment of inertia for a solid polygon shape assuming it's center of gravity is at it's centroid. The offset is added to each vertex.
cpFloat cpAreaForPoly (const int numVerts, const cpVect *verts)
 Calculate the signed area of a polygon.
cpVect cpCentroidForPoly (const int numVerts, const cpVect *verts)
 Calculate the natural centroid of a polygon.
void cpRecenterPoly (const int numVerts, cpVect *verts)
 Center the polygon on the origin. (Subtracts the centroid of the polygon from each vertex).
cpFloat cpMomentForBox (cpFloat m, cpFloat width, cpFloat height)
 Calculate the moment of inertia for a solid box.
cpFloat cpMomentForBox2 (cpFloat m, cpBB box)
 Calculate the moment of inertia for a solid box.

Variables

const char * cpVersionString
 Version string.

Function Documentation

cpFloat cpAreaForCircle ( cpFloat  r1,
cpFloat  r2 
)

Calculate area of a hollow circle.

r1 and r2 are the inner and outer diameters. A solid circle has an inner diameter of 0.

cpFloat cpAreaForPoly ( const int  numVerts,
const cpVect verts 
)

Calculate the signed area of a polygon.

A Clockwise winding gives positive area. This is probably backwards from what you expect, but matches Chipmunk's the winding for poly shapes.

void cpInitChipmunk ( void   ) 
cpFloat cpMomentForCircle ( cpFloat  m,
cpFloat  r1,
cpFloat  r2,
cpVect  offset 
)

Calculate the moment of inertia for a circle.

r1 and r2 are the inner and outer diameters. A solid circle has an inner diameter of 0.

cpFloat cpMomentForSegment ( cpFloat  m,
cpVect  a,
cpVect  b 
)

Calculate the moment of inertia for a line segment.

Beveling radius is not supported.

 All Classes Functions Variables Properties