Expand description
all the math of steel
Re-exports§
pub use crate::angle::DEG_TO_RAD;pub use crate::angle::DEG_TO_RAD_F64;pub use crate::angle::DEGREE_90;pub use crate::angle::DEGREE_180;pub use crate::angle::DEGREE_270;pub use crate::angle::DEGREE_360;pub use crate::angle::RAD_TO_DEG;pub use crate::angle::RAD_TO_DEG_F64;pub use crate::angle::convert_to_rotation_segment;pub use crate::angle::wrap_degrees;
Modules§
- angle
- Shared angle constants. Common angle constants.
- float_
consts - IEEE 754 binary32 layout constants
- noise_
math 🔒 - Math utilities used by vanilla world generation noise.
- rounding 🔒
- Java-compatible floating-point rounding
- trig
- Port of Mojang
net.minecraft.util.Mth’s float trig lookup tables. - vector
- Vanilla
Vec3axis rotations. Rotation helpers forDVec3using Steel trig lookup table.
Constants§
- GRADIENT
- Gradient vectors shared between Perlin and simplex noise (from vanilla
SimplexNoise.GRADIENT). - GRADIENT_
F32 - See
GRADIENTfor details. This is a f32 version of the gradient table for use in f32 noise functions
Functions§
- bias_
towards_ extreme - Bias a noise value towards extremes (-1 or 1) using a sine curve.
- clamp
- Clamp a value to the range [min, max].
- clamp_
i32 - Clamp a value to the range [min, max] (i32 version).
- clamped_
lerp - Clamped linear interpolation.
- clamped_
lerp_ simd - Clamped lerp for N lanes.
- corner_
noise_ 3d - Compute corner noise contribution for a simplex vertex.
- cube
- Cube a value.
- dot
- Dot product of gradient vector and offset vector.
- fast_
floor - Floor function that matches Java behavior.
- fast_
floor_ simd - SIMD implementation of
fast_floor. - fast_
lfloor - Long floor function matching Java behavior.
- grad_
dot - Calculate the f32 dot product used by vanilla Perlin noise.
- grad_
dot_ simd - f32 N-lane gradient dot product.
- inverse_
lerp - Inverse linear interpolation (find the factor t such that lerp(t, a, b) == value).
- lerp
- Linear interpolation.
- lerp2
- Bilinear interpolation.
- lerp3
- Trilinear interpolation.
- lerp2_
simd - SIMD bilinear interpolation.
- lerp3_
simd - Trilinear interpolation for N lanes. see lerp3.
- lerp_
simd - SIMD linear interpolation.
- map
- Map a value from one range to another (unclamped).
- map_
clamped - Map a value from one range to another with clamped lerp.
- round_
f32 - Rounds ties toward positive infinity, unlike
f32::round, which rounds them away from zero. Uses the JDK’s IEEE 754 bit-shift implementation ofMath.round(float), including saturation and NaN handling, without rounding up values just below a half-integer - smoothstep
- Smoothstep - quintic Hermite interpolation (NOT cubic!)
- smoothstep_
derivative - Smoothstep derivative for noise with derivatives.
- smoothstep_
simd - Smoothstep for N lanes: 6x^5 - 15x^4 + 10x^3. Per-lane identical to
smoothstep. - square
- Square a value.
- wrap
- Wrap a coordinate to prevent precision loss at large values.
- wrap_
simd - Wrap N coordinates to prevent precision loss (N-lane SIMD version of
wrap).