Chipmunk  6.0.3
Chipmunk API Reference for Kobold2D developers
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.
#define CP_VERSION_MAJOR   6
#define CP_VERSION_MINOR   0
#define CP_VERSION_RELEASE   3

Typedefs

typedef struct cpHashSet cpHashSet

Functions

void cpInitChipmunk (void)
cpFloat cpMomentForCircle (cpFloat m, cpFloat r1, cpFloat r2, cpVect offset)
cpFloat cpAreaForCircle (cpFloat r1, cpFloat r2)
cpFloat cpMomentForSegment (cpFloat m, cpVect a, cpVect b)
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)
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.

Define Documentation

#define CP_BUFFER_BYTES   (32*1024)

Allocated size for various Chipmunk buffers.

#define CP_VERSION_MAJOR   6
#define CP_VERSION_MINOR   0
#define CP_VERSION_RELEASE   3
#define cpcalloc   calloc

Chipmunk calloc() alias.

#define cpfree   free

Chipmunk free() alias.

#define cprealloc   realloc

Chipmunk realloc() alias.


Typedef Documentation

typedef struct cpHashSet cpHashSet

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.

cpFloat cpAreaForSegment ( cpVect  a,
cpVect  b,
cpFloat  r 
)

Calculate the area of a fattened (capsule shaped) line segment.

cpVect cpCentroidForPoly ( const int  numVerts,
const cpVect verts 
)

Calculate the natural centroid of a polygon.

void cpInitChipmunk ( void  )
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.

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 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 cpMomentForSegment ( cpFloat  m,
cpVect  a,
cpVect  b 
)

Calculate the moment of inertia for a line segment. Beveling radius is not supported.

void cpRecenterPoly ( const int  numVerts,
cpVect verts 
)

Center the polygon on the origin. (Subtracts the centroid of the polygon from each vertex)


Variable Documentation

const char* cpVersionString

Version string.