Expand description
The scalar, vector and rotation primitives the rest of the vocabulary is
built from: the f32 transcendentals core leaves to a math library, the
3-component vector ops every layout and transform reaches for, and the
quaternion / Euler convention rotations are authored and stepped in.
Modules§
- vec3
- The crate’s shared 3-component vector math. Every module that needs a dot, cross, or component-wise op reaches for these rather than redeclaring them.
Functions§
- acos
- Arc cosine, in radians.
- asin
- Arc sine, in radians.
- atan2
- Arc tangent of
y / x, in radians, using both signs to pick the quadrant. - ceil
- Smallest integer at or above
x. - cos
- Cosine of an angle in radians.
- euler_
yxz_ deg_ from_ quat - Engine Euler degrees
[pitch, yaw, roll]for a rotation quaternion, which need not be normalised. - exp
eraised tox.- exp2
- 2 raised to
x. - floor
- Largest integer at or below
x. - fract
- Fractional part, keeping the sign of
x. - hypot
- Length of the hypotenuse of a right triangle with legs
xandy, without the intermediate overflow ofsqrt(x * x + y * y). - ln
- Natural logarithm.
- log2
- Base-2 logarithm.
- mul_add
x * y + zwith a single rounding.- powf
xraised ton.- powi
xraised to the integer powern, by squaring. Matches the expansionf32::powilowers to rather than routing throughpowf, which would round differently.- quat_
from_ axis_ angle - The rotation quaternion for
angle_radaboutaxis, which need not be normalised. An axis too short to have a direction yields the identity. - quat_
from_ euler_ yxz_ deg - The rotation quaternion for engine Euler degrees
[pitch, yaw, roll], applied yaw then pitch then roll. - quat_
normalize - A rotation quaternion scaled to unit length, or the identity when
qis too short to have a direction. - rem_
euclid - Least nonnegative remainder of
x (mod rhs). - round
- Nearest integer, with halves rounded away from zero.
- sin
- Sine of an angle in radians.
- sin_cos
- Sine and cosine of an angle in radians.
- sqrt
- Square root.
- tan
- Tangent of an angle in radians.
- trunc
- Integer part, discarding the fraction and keeping the sign of
x.
Type Aliases§
- Quat
- Unit quaternion
(x, y, z, w)representing a rotation.