module Math
Extended Modules
Defined in:
libgodot/types/math.crClass Method Summary
-
.clamp(val : Float32, min_val : Float32, max_val : Float32) : Float32
Clamps a value between min and max.
- .clamp(val : Float64, min_val : Float64, max_val : Float64) : Float64
-
.deg_to_rad(deg : Number) : Float64
Converts degrees to radians.
-
.is_equal_approx(a : Float64, b : Float64, tolerance : Float64 = 0.00001) : Bool
Returns true if two floating point values are approximately equal within tolerance.
-
.is_zero_approx(a : Float64, tolerance : Float64 = 0.00001) : Bool
Returns true if a floating point value is approximately zero within tolerance.
-
.lerp(from : Float32, to : Float32, weight : Float32) : Float32
Linearly interpolates between from and to by weight.
- .lerp(from : Float64, to : Float64, weight : Float64) : Float64
-
.max(a : Float64, b : Float32) : Float64
Mixed Float32 / Float64 min and max overloads to prevent Float32 | Float64 union inference
- .max(a : Float32, b : Float64) : Float64
- .min(a : Float64, b : Float32) : Float64
- .min(a : Float32, b : Float64) : Float64
-
.move_toward(from : Float32, to : Float32, delta : Float32) : Float32
Moves
fromtowardtoby the givendeltaamount, never exceedingto. -
.move_toward(from : Float64, to : Float64, delta : Float64) : Float64
Moves
fromtowardtoby the givendeltaamount with 64-bit precision, never exceedingto. -
.rad_to_deg(rad : Number) : Float64
Converts radians to degrees.
-
.snapped(val : Float64, step : Float64) : Float64
Snaps a floating point value to the nearest multiple of step.
-
.wrapf(value : Float64, min_val : Float64, max_val : Float64) : Float64
Wraps a floating point number between min and max.
Class Method Detail
Clamps a value between min and max.
Returns true if two floating point values are approximately equal within tolerance.
Returns true if a floating point value is approximately zero within tolerance.
Linearly interpolates between from and to by weight.
Mixed Float32 / Float64 min and max overloads to prevent Float32 | Float64 union inference
Moves from toward to by the given delta amount, never exceeding to.
Moves from toward to by the given delta amount with 64-bit precision, never exceeding to.
Snaps a floating point value to the nearest multiple of step.