pub trait FloatOps<T: Float>: Lerp<T>where
Self: Sized,{
Show 45 methods
// Required methods
fn point_five() -> Self;
fn pi() -> Self;
fn two_pi() -> Self;
fn inv_pi() -> Self;
fn phi() -> Self;
fn inv_phi() -> Self;
fn tau() -> Self;
fn sqrt(a: Self) -> Self;
fn rsqrt(a: Self) -> Self;
fn recip(a: Self) -> Self;
fn powi(a: Self, exp: i32) -> Self;
fn powf(a: Self, exp: T) -> Self;
fn mad(m: Self, a: Self, b: Self) -> Self;
fn approx(a: Self, b: Self, eps: T) -> bool;
fn floor(a: Self) -> Self;
fn ceil(a: Self) -> Self;
fn copysign(a: Self, sign: T) -> Self;
fn smoothstep(e0: Self, e1: Self, t: T) -> Self;
fn round(a: Self) -> Self;
fn is_nan(a: Self) -> Self;
fn is_infinite(a: Self) -> Self;
fn is_finite(a: Self) -> Self;
fn saturate(x: Self) -> Self;
fn deg_to_rad(theta: Self) -> Self;
fn rad_to_deg(theta: Self) -> Self;
fn fmod(x: Self, y: Self) -> Self;
fn frac(v: Self) -> Self;
fn trunc(v: Self) -> Self;
fn modf(v: Self) -> (Self, Self);
fn cos(v: Self) -> Self;
fn sin(v: Self) -> Self;
fn tan(v: Self) -> Self;
fn acos(v: Self) -> Self;
fn asin(v: Self) -> Self;
fn atan(v: Self) -> Self;
fn cosh(v: Self) -> Self;
fn sinh(v: Self) -> Self;
fn tanh(v: Self) -> Self;
fn sin_cos(v: Self) -> (Self, Self);
fn atan2(y: Self, x: Self) -> Self;
fn exp(v: Self) -> Self;
fn exp2(v: Self) -> Self;
fn log2(v: Self) -> Self;
fn log10(v: Self) -> Self;
fn log(v: Self, base: T) -> Self;
}
Expand description
operations applicable to floating point types
Required Methods§
Sourcefn point_five() -> Self
fn point_five() -> Self
returns 0.5
Sourcefn approx(a: Self, b: Self, eps: T) -> bool
fn approx(a: Self, b: Self, eps: T) -> bool
returns true if a
and b
are approximately equal within the designated epsilon eps
Sourcefn copysign(a: Self, sign: T) -> Self
fn copysign(a: Self, sign: T) -> Self
returns value a
with the same sign as the second parameter sign
Sourcefn smoothstep(e0: Self, e1: Self, t: T) -> Self
fn smoothstep(e0: Self, e1: Self, t: T) -> Self
returns hermite interpolation between 0-1
of t
between edges e0
and e1
Sourcefn is_infinite(a: Self) -> Self
fn is_infinite(a: Self) -> Self
returns true if a
is inf
Sourcefn saturate(x: Self) -> Self
fn saturate(x: Self) -> Self
returns the value of a
saturated (clamped between 0-1
). equivalent to clamp(x, 0, 1)
Sourcefn deg_to_rad(theta: Self) -> Self
fn deg_to_rad(theta: Self) -> Self
returns theta
converted from degrees to radians
Sourcefn rad_to_deg(theta: Self) -> Self
fn rad_to_deg(theta: Self) -> Self
returns theta
converted from radians to degrees
Sourcefn frac(v: Self) -> Self
fn frac(v: Self) -> Self
returns the fractional part of floating point number v
removing the integer part
Sourcefn trunc(v: Self) -> Self
fn trunc(v: Self) -> Self
returns the integer part of float value v
truncating the decimal part
Sourcefn modf(v: Self) -> (Self, Self)
fn modf(v: Self) -> (Self, Self)
returns a tuple containing (frac(v), trunc(v))
breaking the float into 2 parts
Sourcefn sin_cos(v: Self) -> (Self, Self)
fn sin_cos(v: Self) -> (Self, Self)
returns a tuple of (sin(v), cos(v))
of v
where the value v
is in radians
fn atan2(y: Self, x: Self) -> Self
fn exp(v: Self) -> Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.