Chipmunk2D Pro API Reference  6.2.1
 All Classes Functions Variables Typedefs Properties Groups Pages
Classes | Functions
cpPolyShape

Functions

cpPolyShape * cpPolyShapeAlloc (void)
 Allocate a polygon shape.
 
cpPolyShape * cpPolyShapeInit (cpPolyShape *poly, cpBody *body, int numVerts, const cpVect *verts, cpVect offset)
 Initialize a polygon shape. More...
 
cpPolyShape * cpPolyShapeInit2 (cpPolyShape *poly, cpBody *body, int numVerts, const cpVect *verts, cpVect offset, cpFloat radius)
 Initialize a polygon shape. More...
 
cpShapecpPolyShapeNew (cpBody *body, int numVerts, const cpVect *verts, cpVect offset)
 Allocate and initialize a polygon shape. More...
 
cpShapecpPolyShapeNew2 (cpBody *body, int numVerts, const cpVect *verts, cpVect offset, cpFloat radius)
 Allocate and initialize a polygon shape. More...
 
cpPolyShape * cpBoxShapeInit (cpPolyShape *poly, cpBody *body, cpFloat width, cpFloat height)
 Initialize a box shaped polygon shape.
 
cpPolyShape * cpBoxShapeInit2 (cpPolyShape *poly, cpBody *body, cpBB box)
 Initialize an offset box shaped polygon shape.
 
cpPolyShape * cpBoxShapeInit3 (cpPolyShape *poly, cpBody *body, cpBB box, cpFloat radius)
 Initialize an offset box shaped polygon shape.
 
cpShapecpBoxShapeNew (cpBody *body, cpFloat width, cpFloat height)
 Allocate and initialize a box shaped polygon shape.
 
cpShapecpBoxShapeNew2 (cpBody *body, cpBB box)
 Allocate and initialize an offset box shaped polygon shape.
 
cpShapecpBoxShapeNew3 (cpBody *body, cpBB box, cpFloat radius)
 Allocate and initialize an offset box shaped polygon shape.
 
cpBool cpPolyValidate (const cpVect *verts, const int numVerts)
 Check that a set of vertexes is convex and has a clockwise winding. More...
 
int cpPolyShapeGetNumVerts (const cpShape *shape)
 Get the number of verts in a polygon shape.
 
cpVect cpPolyShapeGetVert (const cpShape *shape, int idx)
 Get the ith vertex of a polygon shape.
 
cpFloat cpPolyShapeGetRadius (const cpShape *shape)
 Get the radius of a polygon shape.
 

Detailed Description

Function Documentation

cpPolyShape* cpPolyShapeInit ( cpPolyShape *  poly,
cpBody body,
int  numVerts,
const cpVect verts,
cpVect  offset 
)

Initialize a polygon shape.

A convex hull will be created from the vertexes.

cpPolyShape* cpPolyShapeInit2 ( cpPolyShape *  poly,
cpBody body,
int  numVerts,
const cpVect verts,
cpVect  offset,
cpFloat  radius 
)

Initialize a polygon shape.

A convex hull will be created from the vertexes.

cpShape* cpPolyShapeNew ( cpBody body,
int  numVerts,
const cpVect verts,
cpVect  offset 
)

Allocate and initialize a polygon shape.

A convex hull will be created from the vertexes.

cpShape* cpPolyShapeNew2 ( cpBody body,
int  numVerts,
const cpVect verts,
cpVect  offset,
cpFloat  radius 
)

Allocate and initialize a polygon shape.

A convex hull will be created from the vertexes.

cpBool cpPolyValidate ( const cpVect verts,
const int  numVerts 
)

Check that a set of vertexes is convex and has a clockwise winding.

NOTE: Due to floating point precision issues, hulls created with cpQuickHull() are not guaranteed to validate!