Rapier C — 3D / f32 0.36.0+c.0
Loading...
Searching...
No Matches
rapier_math.h File Reference

Inline value constructors and arithmetic; no allocation or error-state changes. More...

Go to the source code of this file.

Macros

#define R3_PI   ((R3Real)3.14159265358979323846)
 Pi in the selected scalar precision.

Functions

static R3Vector r3Vector (R3Real x, R3Real y, R3Real z)
 Construct a vector from its components.
static R3Rotation r3RotationFromAxisAngle (R3Vector axis, R3Real angle)
 Construct a 3D unit quaternion; normalizes axis, and returns identity for a zero axis.
static R3Vector r3VectorAdd (R3Vector a, R3Vector b)
 Return a + b.
static R3Vector r3VectorSub (R3Vector a, R3Vector b)
 Return a - b.
static R3Vector r3VectorScale (R3Vector vector, R3Real scale)
 Multiply each component by scale.
static R3Real r3VectorDot (R3Vector a, R3Vector b)
 Return the dot product.
static R3Real r3VectorLength (R3Vector vector)
 Return the Euclidean length.
static R3Vector r3VectorNormalize (R3Vector vector)
 Normalize a nonzero vector; a zero vector is returned unchanged.
static R3Vector r3VectorCross (R3Vector a, R3Vector b)
 Return the 3D cross product a x b.
static R3Rotation r3RotationMul (R3Rotation a, R3Rotation b)
 Compose rotations, applying b then a.
static R3Vector r3RotationTransformVector (R3Rotation rotation, R3Vector vector)
 Rotate a vector; rotation must be normalized.
static R3Pose r3Pose (R3Vector translation, R3Rotation rotation)
 Construct a pose from translation and rotation without validation.
static R3Pose r3TranslationPose (R3Vector translation)
 Construct a pose with the supplied translation and identity rotation.
static R3MassProperties r3MassProperties (R3Vector local_com, R3Real mass, R3AngVector principal_inertia)
 Construct mass properties from a local center of mass, a mass, and principal angular inertia (a scalar in 2D); in 3D the principal inertia frame is the identity rotation.
static R3Rotation r3RotationInverse (R3Rotation rotation)
 Return the inverse of a normalized rotation.
static R3Vector r3PoseTransformPoint (R3Pose pose, R3Vector point)
 Transform a point by rotation then translation.
static R3Pose r3PoseInverse (R3Pose pose)
 Return the inverse rigid transform.

Detailed Description

Inline value constructors and arithmetic; no allocation or error-state changes.

Trigonometry uses the library's Sin and Cos, so results match across platforms with enhanced-determinism; square roots are exactly rounded everywhere.