Trait FloatOps

Source
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§

Source

fn point_five() -> Self

returns 0.5

Source

fn pi() -> Self

returns pi

Source

fn two_pi() -> Self

returns 2.0 * pi

Source

fn inv_pi() -> Self

returns 1.0 / pi

Source

fn phi() -> Self

returns phi (the golden constant)

Source

fn inv_phi() -> Self

returns 1.0 / phi inverse phi (the golden constant)

Source

fn tau() -> Self

returns tau, which is ratio of the circumference of a circle to its radius

Source

fn sqrt(a: Self) -> Self

returns square root of a

Source

fn rsqrt(a: Self) -> Self

returns reciprocal square root of a (1/sqrt(a))

Source

fn recip(a: Self) -> Self

returns the reciprocal of a

Source

fn powi(a: Self, exp: i32) -> Self

returns a raised to integer power exp

Source

fn powf(a: Self, exp: T) -> Self

returns a raised to float power exp

Source

fn mad(m: Self, a: Self, b: Self) -> Self

returns fused multiply add a * m + b

Source

fn approx(a: Self, b: Self, eps: T) -> bool

returns true if a and b are approximately equal within the designated epsilon eps

Source

fn floor(a: Self) -> Self

returns the greatest integer which is less than or equal to a

Source

fn ceil(a: Self) -> Self

returns the smallest integer which is greater than or equal to a

Source

fn copysign(a: Self, sign: T) -> Self

returns value a with the same sign as the second parameter sign

Source

fn smoothstep(e0: Self, e1: Self, t: T) -> Self

returns hermite interpolation between 0-1 of t between edges e0 and e1

Source

fn round(a: Self) -> Self

returns a rounded component wise

Source

fn is_nan(a: Self) -> Self

returns true if a is not a number (nan)

Source

fn is_infinite(a: Self) -> Self

returns true if a is inf

Source

fn is_finite(a: Self) -> Self

returns true is a is finite

Source

fn saturate(x: Self) -> Self

returns the value of a saturated (clamped between 0-1). equivalent to clamp(x, 0, 1)

Source

fn deg_to_rad(theta: Self) -> Self

returns theta converted from degrees to radians

Source

fn rad_to_deg(theta: Self) -> Self

returns theta converted from radians to degrees

Source

fn fmod(x: Self, y: Self) -> Self

returns the floating-point remainder of x/y

Source

fn frac(v: Self) -> Self

returns the fractional part of floating point number v removing the integer part

Source

fn trunc(v: Self) -> Self

returns the integer part of float value v truncating the decimal part

Source

fn modf(v: Self) -> (Self, Self)

returns a tuple containing (frac(v), trunc(v)) breaking the float into 2 parts

Source

fn cos(v: Self) -> Self

returns the cosine of v where the value v is in radians

Source

fn sin(v: Self) -> Self

returns the sine of v where the value v is in radians

Source

fn tan(v: Self) -> Self

returns the tangent of v where the value v is in radians

Source

fn acos(v: Self) -> Self

returns the arc cosine of v where the value v is in radians

Source

fn asin(v: Self) -> Self

returns the arc sine of v where the value v is in radians

Source

fn atan(v: Self) -> Self

returns the arc tangent of v where the value v is in radians

Source

fn cosh(v: Self) -> Self

returns the hyperbolic cosine of v where the value v is in radians

Source

fn sinh(v: Self) -> Self

returns the hyperbolic sine of v where the value v is in radians

Source

fn tanh(v: Self) -> Self

returns the hyperbolic tangent of v where the value v is in radians

Source

fn sin_cos(v: Self) -> (Self, Self)

returns a tuple of (sin(v), cos(v)) of v where the value v is in radians

Source

fn atan2(y: Self, x: Self) -> Self

Source

fn exp(v: Self) -> Self

Source

fn exp2(v: Self) -> Self

returns 2 raised to the given power v

Source

fn log2(v: Self) -> Self

returns the binary (base-2) logarithm of v

Source

fn log10(v: Self) -> Self

returns the common (base-10) logarithm of v

Source

fn log(v: Self, base: T) -> Self

returns the logarithm of v in base

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.

Implementations on Foreign Types§

Source§

impl FloatOps<f32> for f32

Source§

fn floor(v: Self) -> Self

Source§

fn ceil(v: Self) -> Self

Source§

fn round(v: Self) -> Self

Source§

fn sqrt(v: Self) -> Self

Source§

fn recip(v: Self) -> Self

Source§

fn cos(v: Self) -> Self

Source§

fn sin(v: Self) -> Self

Source§

fn tan(v: Self) -> Self

Source§

fn acos(v: Self) -> Self

Source§

fn asin(v: Self) -> Self

Source§

fn atan(v: Self) -> Self

Source§

fn cosh(v: Self) -> Self

Source§

fn sinh(v: Self) -> Self

Source§

fn tanh(v: Self) -> Self

Source§

fn exp(v: Self) -> Self

Source§

fn exp2(v: Self) -> Self

Source§

fn log2(v: Self) -> Self

Source§

fn log10(v: Self) -> Self

Source§

fn point_five() -> Self

Source§

fn pi() -> Self

Source§

fn two_pi() -> Self

Source§

fn inv_pi() -> Self

Source§

fn phi() -> Self

Source§

fn inv_phi() -> Self

Source§

fn tau() -> Self

Source§

fn rsqrt(a: Self) -> Self

Source§

fn approx(a: Self, b: Self, eps: Self) -> bool

Source§

fn mad(m: Self, a: Self, b: Self) -> Self

Source§

fn is_nan(v: Self) -> f32

Source§

fn is_infinite(v: Self) -> f32

Source§

fn is_finite(v: Self) -> f32

Source§

fn copysign(a: Self, sign: f32) -> Self

Source§

fn smoothstep(e0: Self, e1: Self, t: Self) -> Self

Source§

fn saturate(v: Self) -> Self

Source§

fn powi(v: Self, exp: i32) -> Self

Source§

fn powf(v: Self, exp: f32) -> Self

Source§

fn fmod(x: Self, y: Self) -> Self

Source§

fn frac(v: Self) -> Self

Source§

fn trunc(v: Self) -> Self

Source§

fn modf(v: Self) -> (Self, Self)

Source§

fn log(v: Self, base: Self) -> Self

Source§

fn sin_cos(v: Self) -> (Self, Self)

Source§

fn atan2(y: Self, x: Self) -> Self

Source§

fn deg_to_rad(theta: Self) -> Self

Source§

fn rad_to_deg(theta: Self) -> Self

Source§

impl FloatOps<f64> for f64

Source§

fn floor(v: Self) -> Self

Source§

fn ceil(v: Self) -> Self

Source§

fn round(v: Self) -> Self

Source§

fn sqrt(v: Self) -> Self

Source§

fn recip(v: Self) -> Self

Source§

fn cos(v: Self) -> Self

Source§

fn sin(v: Self) -> Self

Source§

fn tan(v: Self) -> Self

Source§

fn acos(v: Self) -> Self

Source§

fn asin(v: Self) -> Self

Source§

fn atan(v: Self) -> Self

Source§

fn cosh(v: Self) -> Self

Source§

fn sinh(v: Self) -> Self

Source§

fn tanh(v: Self) -> Self

Source§

fn exp(v: Self) -> Self

Source§

fn exp2(v: Self) -> Self

Source§

fn log2(v: Self) -> Self

Source§

fn log10(v: Self) -> Self

Source§

fn point_five() -> Self

Source§

fn pi() -> Self

Source§

fn two_pi() -> Self

Source§

fn inv_pi() -> Self

Source§

fn phi() -> Self

Source§

fn inv_phi() -> Self

Source§

fn tau() -> Self

Source§

fn rsqrt(a: Self) -> Self

Source§

fn approx(a: Self, b: Self, eps: Self) -> bool

Source§

fn mad(m: Self, a: Self, b: Self) -> Self

Source§

fn is_nan(v: Self) -> f64

Source§

fn is_infinite(v: Self) -> f64

Source§

fn is_finite(v: Self) -> f64

Source§

fn copysign(a: Self, sign: f64) -> Self

Source§

fn smoothstep(e0: Self, e1: Self, t: Self) -> Self

Source§

fn saturate(v: Self) -> Self

Source§

fn powi(v: Self, exp: i32) -> Self

Source§

fn powf(v: Self, exp: f64) -> Self

Source§

fn fmod(x: Self, y: Self) -> Self

Source§

fn frac(v: Self) -> Self

Source§

fn trunc(v: Self) -> Self

Source§

fn modf(v: Self) -> (Self, Self)

Source§

fn log(v: Self, base: Self) -> Self

Source§

fn sin_cos(v: Self) -> (Self, Self)

Source§

fn atan2(y: Self, x: Self) -> Self

Source§

fn deg_to_rad(theta: Self) -> Self

Source§

fn rad_to_deg(theta: Self) -> Self

Implementors§

Source§

impl<T> FloatOps<T> for Vec2<T>
where T: Float + SignedNumberOps<T> + NumberOps<T> + FloatOps<T>,

Source§

impl<T> FloatOps<T> for Vec3<T>
where T: Float + SignedNumberOps<T> + NumberOps<T> + FloatOps<T>,

Source§

impl<T> FloatOps<T> for Vec4<T>
where T: Float + SignedNumberOps<T> + NumberOps<T> + FloatOps<T>,