Trait maths_rs::num::FloatOps

source ·
pub trait FloatOps<T: Float>: Lerp<T>where
    Self: Sized,{
Show 44 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 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 (the golden constant)

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

Implementations on Foreign Types§

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

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

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>,