Skip to main content

Module math

Module math 

Source
Expand description

Engine math helpers (Runtime-steam-x64.dll Math::Scalar, Math::Vector2/3) with the original’s precision: the C runtime’s sinf/cosf/atan2f (crate::crt), sqrtf (correctly rounded), and the operations in the original’s order.

Structs§

Transform
The engine’s transform: a rotation (a quaternion) and an offset. A placed model keeps its position this way.

Constants§

DEG_TO_RAD
Degrees to radians as an f32.
RAD_TO_DEG
Radians to degrees.

Functions§

cosf
The cosine of x (radians), with the C runtime’s rounding (crate::crt::cosf).
from_yaw_pitch
The direction of a yaw and a pitch, in degrees: (−cos p · sin y, cos p · cos y, sin p).
heading
The heading of a 2D direction, in degrees: atan2f(−x, y).
length3
The length of a 3D vector: sqrtf((x·x + y·y) + z·z), added in that order.
normalize2
A 2D vector scaled to length 1. A zero vector is returned as it is.
normalize3
A 3D vector scaled to length 1. A zero vector is returned as it is.
normalize3_len
A 3D vector scaled to length 1 (times 1 / length), and its length. A zero vector is returned as it is.
sin_cos_deg
The sine and cosine of an angle in degrees.
sinf
The sine of x (radians), with the C runtime’s rounding (crate::crt::sinf).