|
coastline 0.0.4
|
The rigid bodies of the physics: their state, forces and inertia, and the quaternion and 3 by 3 matrix arithmetic they use. More...


Go to the source code of this file.
Classes | |
| struct | Quaternion |
| A rotation as a unit quaternion. More... | |
| struct | RigidBodyState |
| The motion of a rigid body at an instant. More... | |
| struct | RigidBodyForce |
| A force on a rigid body, in a list. More... | |
| struct | RigidBody |
| A rigid body: the body of a vehicle or of one of its wheels. More... | |
Typedefs | |
| typedef struct RigidBodyForce | RigidBodyForce |
| A force on a rigid body, in a list. | |
| typedef struct RigidBody | RigidBody |
| A rigid body: the body of a vehicle or of one of its wheels. | |
Enumerations | |
| enum | { RIGID_BODY_FORCE_WORLD , RIGID_BODY_FORCE_BODY } |
| The frames a force can be given in. More... | |
| enum | { RIGID_BODY_BOX , RIGID_BODY_BOX_1 , RIGID_BODY_NO_ROTATION } |
| The kinds of rigid body. More... | |
Functions | |
| void | StubPhysics1 (void *data) |
| An empty hook the inertia setup calls. | |
| void | MatrixToQuaternion (f32 m[4][4], Quaternion *q) |
| The unit quaternion of the rotation of a matrix, from the largest of its diagonal terms. | |
| void | StubPhysics2 (void *data) |
| An empty hook QuaternionToMatrix() calls. | |
| void | QuaternionMultiply (Quaternion *out, Quaternion *a, Quaternion *b) |
| The product of two quaternions. | |
| void | QuaternionNormalize (Quaternion *q) |
| Make a quaternion a unit quaternion. | |
| void | Vec3fNormalizeFast (Vec3f *v) |
| Make a vector a unit vector. | |
| void | ComputeDeltaQuaternion (RigidBodyState *state) |
| The rate of change of the orientation from the angular velocity: half of the product of the angular velocity and the orientation. | |
| void | ApplyRigidBodyImpulse (RigidBodyState *state, RigidBody *body, f32 dt) |
| Add the force and torque of a body over a time to the velocity and angular velocity of a state. | |
| void | QuaternionToMatrix (f32 out[4][4], RigidBodyState *state) |
| The 4 by 4 matrix of the orientation and position of a state. | |
| void | IntegrateRigidBodyState (RigidBodyState *out, RigidBodyState *in, f32 dt) |
| Advance a state by a time, keeping its velocities. | |
| void | SetRigidBodyForce (RigidBodyForce *force, f32 x, f32 y, f32 z, f32 pointX, f32 pointY, f32 pointZ, s32 frame) |
| Set the vector, the point, and the frame of a force. | |
| void | Mtx4fInverseRotate (Vec3f *out, f32 m[4][4], Vec3f *v) |
| The dot products of the rotation rows of a matrix with a vector, which turns a vector of the world into the frame of the matrix. | |
| void | Mtx3x3MulVec3f (Vec3f *out, f32 m[4][4], Vec3f *v) |
| A vector times the rotation of a matrix, which turns a vector of the frame into the world. | |
| void | Mtx4x4TransformPoint (Vec3f *out, f32 m[4][4], Vec3f *v) |
| A point times a matrix, with its translation. | |
| void | Mtx3fMulVec3f (Vec3f *out, f32 m[3][3], Vec3f *v) |
| A 3 by 3 matrix times a column vector. | |
| void | ComputeRigidBodyAcceleration (RigidBody *body) |
| Turn the summed force and torque of a body into its accelerations. | |
| void | ApplySingleForceWithDebug (RigidBody *body, RigidBodyForce *force) |
| Add a force and its torque to the sums of a body, and print both on the debug output. | |
| void | ApplyAllForcesToBody (RigidBody *body) |
| Add each force of the list of a body to its sums of force and torque, printing each on the debug output. | |
| void | InitRigidBody (RigidBody *body) |
| Reset a body, and set the inertia of a box from its size and mass. | |
| void | BuildSkewSymmetricMatrix (f32 out[3][3], Vec3f *v) |
| The matrix of the cross product with a vector. | |
| void | TransposeCopyMatrix3x3 (f32 transpose[3][3], f32 copy[3][3], f32 m[4][4]) |
| Copy the rotation of a matrix, and its transpose. | |
| void | Transpose4x4Into3x3 (f32 out[3][3], f32 m[4][4]) |
| The transpose of the rotation of a matrix. | |
| void | CopyMatrix4x4To3x3 (f32 out[3][3], f32 m[4][4]) |
| Copy the rotation of a matrix. | |
| void | Mtx3fMultiply (f32 out[3][3], f32 a[3][3], f32 b[3][3]) |
| The product of two 3 by 3 matrices. | |
| void | SubtractMatrix3x3 (f32 out[3][3], f32 a[3][3], f32 b[3][3]) |
| The difference of two 3 by 3 matrices. | |
| void | MtxBuildScaledInverse (f32 m[4][4], f32 out[4][4], Vec3f *scale) |
| The inverse of a rigid transform whose axes are scaled. | |
| void | SolveLinearSystem3x3 (Vec3f *out, f32 a[3][3], Vec3f *b) |
| Solve a system of three linear equations by Cramer's rule. | |
The rigid bodies of the physics: their state, forces and inertia, and the quaternion and 3 by 3 matrix arithmetic they use.
A 3 by 3 matrix is packed in nine words; the rotation part of a 4 by 4 matrix is its first three rows.
| typedef struct RigidBodyForce RigidBodyForce |
A force on a rigid body, in a list.
| typedef struct RigidBody RigidBody |
A rigid body: the body of a vehicle or of one of its wheels.
A wheel uses the ground, steering, spin and suspension fields, the body of a vehicle the springs, box and collision fields.
| anonymous enum |
| anonymous enum |
| void StubPhysics1 | ( | void * | data | ) |
An empty hook the inertia setup calls.
| data | The inertia of the body, ignored. |
| void MatrixToQuaternion | ( | f32 | m[4][4], |
| Quaternion * | q ) |
The unit quaternion of the rotation of a matrix, from the largest of its diagonal terms.
| m | The matrix. |
| q | Receives the quaternion. |
| void StubPhysics2 | ( | void * | data | ) |
An empty hook QuaternionToMatrix() calls.
| data | The matrix just built, ignored. |
| void QuaternionMultiply | ( | Quaternion * | out, |
| Quaternion * | a, | ||
| Quaternion * | b ) |
The product of two quaternions.
| out | Receives a times b, and may be either factor. |
| a | The left factor. |
| b | The right factor. |
| void QuaternionNormalize | ( | Quaternion * | q | ) |
Make a quaternion a unit quaternion.
| q | The quaternion, normalised in place. |
| void Vec3fNormalizeFast | ( | Vec3f * | v | ) |
Make a vector a unit vector.
| v | The non-zero vector, normalised in place. |
| void ComputeDeltaQuaternion | ( | RigidBodyState * | state | ) |
The rate of change of the orientation from the angular velocity: half of the product of the angular velocity and the orientation.
| state | The state whose spin is set. |
| void ApplyRigidBodyImpulse | ( | RigidBodyState * | state, |
| RigidBody * | body, | ||
| f32 | dt ) |
Add the force and torque of a body over a time to the velocity and angular velocity of a state.
| state | The state to change. |
| body | The body whose force and torque are added. |
| dt | The time over which they act. |
| void QuaternionToMatrix | ( | f32 | out[4][4], |
| RigidBodyState * | state ) |
The 4 by 4 matrix of the orientation and position of a state.
| out | Receives the matrix. |
| state | The state. |
| void IntegrateRigidBodyState | ( | RigidBodyState * | out, |
| RigidBodyState * | in, | ||
| f32 | dt ) |
Advance a state by a time, keeping its velocities.
| out | Receives the advanced state. |
| in | The state to advance. |
| dt | The time to advance by. |
| void SetRigidBodyForce | ( | RigidBodyForce * | force, |
| f32 | x, | ||
| f32 | y, | ||
| f32 | z, | ||
| f32 | pointX, | ||
| f32 | pointY, | ||
| f32 | pointZ, | ||
| s32 | frame ) |
Set the vector, the point, and the frame of a force.
| force | The force to set. |
| x | The x of the vector. |
| y | The y of the vector. |
| z | The z of the vector. |
| pointX | The x of the point the force acts at, in the frame of the body. |
| pointY | The y of the point. |
| pointZ | The z of the point. |
| frame | The frame of the vector, RIGID_BODY_FORCE_WORLD or RIGID_BODY_FORCE_BODY. |
The dot products of the rotation rows of a matrix with a vector, which turns a vector of the world into the frame of the matrix.
| out | Receives the vector in the frame of the matrix. |
| m | The matrix. |
| v | The vector in the world. |
A vector times the rotation of a matrix, which turns a vector of the frame into the world.
| out | Receives the vector in the world. |
| m | The matrix. |
| v | The vector in the frame of the matrix. |
A point times a matrix, with its translation.
| out | Receives the transformed point. |
| m | The matrix. |
| v | The point. |
A 3 by 3 matrix times a column vector.
| out | Receives the product. |
| m | The matrix. |
| v | The vector. |
| void ComputeRigidBodyAcceleration | ( | RigidBody * | body | ) |
Turn the summed force and torque of a body into its accelerations.
| body | The body whose sums become its accelerations. |
| void ApplySingleForceWithDebug | ( | RigidBody * | body, |
| RigidBodyForce * | force ) |
Add a force and its torque to the sums of a body, and print both on the debug output.
| body | The body. |
| force | The force to add. |
| void ApplyAllForcesToBody | ( | RigidBody * | body | ) |
Add each force of the list of a body to its sums of force and torque, printing each on the debug output.
| body | The body. |
| void InitRigidBody | ( | RigidBody * | body | ) |
Reset a body, and set the inertia of a box from its size and mass.
| body | The body, with its kind, size, and mass already set. |
The matrix of the cross product with a vector.
| out | Receives the matrix. |
| v | The vector. |
Copy the rotation of a matrix, and its transpose.
| transpose | Receives the transpose of the rotation. |
| copy | Receives the rotation. |
| m | The matrix. |
The transpose of the rotation of a matrix.
| out | Receives the transpose. |
| m | The matrix. |
Copy the rotation of a matrix.
| out | Receives the rotation. |
| m | The matrix. |
The product of two 3 by 3 matrices.
| out | Receives a times b, and must be neither factor. |
| a | The left factor. |
| b | The right factor. |
The difference of two 3 by 3 matrices.
| out | Receives a minus b. |
| a | The matrix subtracted from. |
| b | The matrix subtracted. |
The inverse of a rigid transform whose axes are scaled.
| m | The transform. |
| out | Receives the inverse. |
| scale | The factors the columns of the inverted rotation are scaled by. |
Solve a system of three linear equations by Cramer's rule.
| out | Receives the solution. |
| a | The coefficients. |
| b | The constants. |