|
Chipmunk
6.0.3
Chipmunk API Reference for Kobold2D developers
|
Functions | |
| static cpVect | cpv (const cpFloat x, const cpFloat y) |
| Convenience constructor for cpVect structs. | |
| cpFloat | cpvlength (const cpVect v) |
| Returns the length of v. | |
| cpVect | cpvslerp (const cpVect v1, const cpVect v2, const cpFloat t) |
| Spherical linearly interpolate between v1 and v2. | |
| cpVect | cpvslerpconst (const cpVect v1, const cpVect v2, const cpFloat a) |
| Spherical linearly interpolate between v1 towards v2 by no more than angle a radians. | |
| cpVect | cpvforangle (const cpFloat a) |
| Returns the unit length vector for the given angle (in radians). | |
| cpFloat | cpvtoangle (const cpVect v) |
| Returns the angular direction v is pointing in (in radians). | |
| char * | cpvstr (const cpVect v) |
| static cpBool | cpveql (const cpVect v1, const cpVect v2) |
| Check if two vectors are equal. (Be careful when comparing floating point numbers!) | |
| static cpVect | cpvadd (const cpVect v1, const cpVect v2) |
| Add two vectors. | |
| static cpVect | cpvsub (const cpVect v1, const cpVect v2) |
| Subtract two vectors. | |
| static cpVect | cpvneg (const cpVect v) |
| Negate a vector. | |
| static cpVect | cpvmult (const cpVect v, const cpFloat s) |
| Scalar multiplication. | |
| static cpFloat | cpvdot (const cpVect v1, const cpVect v2) |
| Vector dot product. | |
| static cpFloat | cpvcross (const cpVect v1, const cpVect v2) |
| static cpVect | cpvperp (const cpVect v) |
| Returns a perpendicular vector. (90 degree rotation) | |
| static cpVect | cpvrperp (const cpVect v) |
| Returns a perpendicular vector. (-90 degree rotation) | |
| static cpVect | cpvproject (const cpVect v1, const cpVect v2) |
| Returns the vector projection of v1 onto v2. | |
| static cpVect | cpvrotate (const cpVect v1, const cpVect v2) |
| Uses complex number multiplication to rotate v1 by v2. Scaling will occur if v1 is not a unit vector. | |
| static cpVect | cpvunrotate (const cpVect v1, const cpVect v2) |
| Inverse of cpvrotate(). | |
| static cpFloat | cpvlengthsq (const cpVect v) |
| Returns the squared length of v. Faster than cpvlength() when you only need to compare lengths. | |
| static cpVect | cpvlerp (const cpVect v1, const cpVect v2, const cpFloat t) |
| Linearly interpolate between v1 and v2. | |
| static cpVect | cpvnormalize (const cpVect v) |
| Returns a normalized copy of v. | |
| static cpVect | cpvnormalize_safe (const cpVect v) |
| Returns a normalized copy of v or cpvzero if v was already cpvzero. Protects against divide by zero errors. | |
| static cpVect | cpvclamp (const cpVect v, const cpFloat len) |
| Clamp v to length len. | |
| static cpVect | cpvlerpconst (cpVect v1, cpVect v2, cpFloat d) |
| Linearly interpolate between v1 towards v2 by distance d. | |
| static cpFloat | cpvdist (const cpVect v1, const cpVect v2) |
| Returns the distance between v1 and v2. | |
| static cpFloat | cpvdistsq (const cpVect v1, const cpVect v2) |
| Returns the squared distance between v1 and v2. Faster than cpvdist() when you only need to compare distances. | |
| static cpBool | cpvnear (const cpVect v1, const cpVect v2, const cpFloat dist) |
| Returns true if the distance between v1 and v2 is less than dist. | |
Variables | |
| static const cpVect | cpvzero = {0.0f,0.0f} |
| Constant for the zero vector. | |
Chipmunk's 2D vector type along with a handy 2D vector math lib.
Chipmunk's 2D vector type.
Convenience constructor for cpVect structs.
Clamp v to length len.
2D vector cross product analog. The cross product of 2D vectors results in a 3D vector with only a z component. This function returns the magnitude of the z value.
Returns the distance between v1 and v2.
Returns the squared distance between v1 and v2. Faster than cpvdist() when you only need to compare distances.
Check if two vectors are equal. (Be careful when comparing floating point numbers!)
Returns the unit length vector for the given angle (in radians).
Returns the squared length of v. Faster than cpvlength() when you only need to compare lengths.
Linearly interpolate between v1 and v2.
Linearly interpolate between v1 towards v2 by distance d.
Returns true if the distance between v1 and v2 is less than dist.
Returns a normalized copy of v or cpvzero if v was already cpvzero. Protects against divide by zero errors.
Returns a perpendicular vector. (90 degree rotation)
Returns the vector projection of v1 onto v2.
Uses complex number multiplication to rotate v1 by v2. Scaling will occur if v1 is not a unit vector.
Returns a perpendicular vector. (-90 degree rotation)
Spherical linearly interpolate between v1 and v2.
Spherical linearly interpolate between v1 towards v2 by no more than angle a radians.
| char* cpvstr | ( | const cpVect | v | ) |
Returns a string representation of v. Intended mostly for debugging purposes and not production use.
Inverse of cpvrotate().