Skip to main content

Crate steel_math

Crate steel_math 

Source
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 Vec3 axis rotations. Rotation helpers for DVec3 using Steel trig lookup table.

Constants§

GRADIENT
Gradient vectors shared between Perlin and simplex noise (from vanilla SimplexNoise.GRADIENT).
GRADIENT_F32
See GRADIENT for 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 of Math.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).