Expand description
Math types and utilities.
Modules§
- affine_
transform - Affine transformations for 2D and 3D space.
- color
- Defines the
LinearRgbacolor type and associated operations. - dimension
- Provides structs for representing extents (sizes) and origins (offsets) in 1D, 2D, and 3D.
- geometry
- Provides geometric primitive shapes for spatial calculations.
- matrix
- Defines the
Mat3andMat4types and associated operations. - quaternion
- Provides a Quaternion type for representing 3D rotations.
- vector
- Provides 2D, 3D, and 4D vector types and their associated operations.
Structs§
- Aabb
- Represents an Axis-Aligned Bounding Box (AABB).
- Affine
Transform - Represents a 3D affine transformation (translation, rotation, scale).
- Extent1D
- A one-dimensional extent, typically representing a width.
- Extent2D
- A two-dimensional extent, typically representing width and height.
- Extent3D
- A three-dimensional extent, representing width, height, and depth.
- Linear
Rgba - Represents a color in a linear RGBA color space using
f32components. - Mat3
- A 3x3 column-major matrix, typically used for 2D affine transformations (scale, rotation).
- Mat4
- A 4x4 column-major matrix, used for 3D affine transformations.
- Origin2D
- A two-dimensional origin, typically representing an (x, y) offset.
- Origin3D
- A three-dimensional origin, representing an (x, y, z) offset.
- Quaternion
- Represents a quaternion for efficient 3D rotations.
- Vec2
- A 2-dimensional vector with
f32components. - Vec3
- A 3-dimensional vector with
f32components. - Vec4
- A 4-dimensional vector with
f32components, often used for homogeneous coordinates.
Constants§
- DEG_
TO_ RAD - The factor to convert degrees to radians (PI / 180.0).
- E
- Euler’s number (e)
- EPSILON
- A small constant for floating-point comparisons.
- FRAC_
PI_ 2 - π/2
- FRAC_
PI_ 3 - π/3
- FRAC_
PI_ 4 - π/4
- FRAC_
PI_ 6 - π/6
- FRAC_
PI_ 8 - π/8
- LN_2
- ln(2)
- LN_10
- ln(10)
- LOG2_E
- log2(e)
- LOG10_E
- log10(e)
- PI
- Archimedes’ constant (π)
- RAD_
TO_ DEG - The factor to convert radians to degrees (180.0 / PI).
- SQRT_2
- sqrt(2)
- TAU
- The full circle constant (τ)
Functions§
- approx_
eq - Performs an approximate equality comparison using the module’s default
EPSILON. - approx_
eq_ eps - Performs an approximate equality comparison between two floats with a custom tolerance.
- clamp
- Clamps a value to a specified minimum and maximum range.
- degrees_
to_ radians - Converts an angle from degrees to radians.
- radians_
to_ degrees - Converts an angle from radians to degrees.
- saturate
- Clamps a floating-point value to the
[0.0, 1.0]range.
Type Aliases§
- Quat
- Alias for
Quaternionfor brevity.