Chipmunk2D Pro API Reference
7.0.1
|
Chipmunk's 2D vector type along with a handy 2D vector math lib. More...
Functions | |
static cpVect | cpv (const cpFloat x, const cpFloat y) |
Convenience constructor for cpVect structs. | |
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) |
2D vector cross product analog. More... | |
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 | cpvforangle (const cpFloat a) |
Returns the unit length vector for the given angle (in radians). | |
static cpFloat | cpvtoangle (const cpVect v) |
Returns the angular direction v is pointing in (in radians). | |
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 cpFloat | cpvlength (const cpVect v) |
Returns the length of v. | |
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 | cpvslerp (const cpVect v1, const cpVect v2, const cpFloat t) |
Spherical linearly interpolate between v1 and v2. | |
static 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. | |
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.