Trait maths_rs::vec::VecFloatOps
source · pub trait VecFloatOps<T: Float>: SignedVecN<T> + Magnitude<T> {
// Required methods
fn distance(a: Self, b: Self) -> T;
fn dist(a: Self, b: Self) -> T;
fn dist2(a: Self, b: Self) -> T;
fn reflect(i: Self, n: Self) -> Self;
fn refract(i: Self, n: Self, eta: T) -> Self;
fn vlerp(e0: Self, e1: Self, t: Self) -> Self;
fn vsmoothstep(e0: Self, e1: Self, t: Self) -> Self;
fn powfn(a: Self, exp: Self) -> Self;
}Expand description
operations to apply to n-dimensional vectors
Required Methods§
sourcefn distance(a: Self, b: Self) -> T
fn distance(a: Self, b: Self) -> T
returns scalar distance between point a and b (magnitude of the vector between the 2 points)
sourcefn dist(a: Self, b: Self) -> T
fn dist(a: Self, b: Self) -> T
returns scalar distance between point a and b (magnitude of the vector between the 2 points)
sourcefn dist2(a: Self, b: Self) -> T
fn dist2(a: Self, b: Self) -> T
returns scalar squared distance between point a and b to avoid using sqrt
sourcefn reflect(i: Self, n: Self) -> Self
fn reflect(i: Self, n: Self) -> Self
returns a reflection vector using an incident ray i and a surface normal n
sourcefn refract(i: Self, n: Self, eta: T) -> Self
fn refract(i: Self, n: Self, eta: T) -> Self
returns a refraction vector using an entering ray i, a surface normal n, and a refraction index eta
sourcefn vlerp(e0: Self, e1: Self, t: Self) -> Self
fn vlerp(e0: Self, e1: Self, t: Self) -> Self
returns linear interpolation between e0 and e1, t specifies the ratio to interpolate between the values, with component-wise t
sourcefn vsmoothstep(e0: Self, e1: Self, t: Self) -> Self
fn vsmoothstep(e0: Self, e1: Self, t: Self) -> Self
returns vector with component wise hermite interpolation between 0-1, with component-wise t