pub trait VecFloatOps<T>: SignedVecN<T> + Magnitude<T>
where T: Float,
{ // 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§

source

fn distance(a: Self, b: Self) -> T

returns scalar distance between point a and b (magnitude of the vector between the 2 points)

source

fn dist(a: Self, b: Self) -> T

returns scalar distance between point a and b (magnitude of the vector between the 2 points)

source

fn dist2(a: Self, b: Self) -> T

returns scalar squared distance between point a and b to avoid using sqrt

source

fn reflect(i: Self, n: Self) -> Self

returns a reflection vector using an incident ray i and a surface normal n

source

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

source

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

source

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

returns vector with component wise hermite interpolation between 0-1, with component-wise t

source

fn powfn(a: Self, exp: Self) -> Self

returns vector a raised to component wise power exp

Object Safety§

This trait is not object safe.

Implementors§

source§

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

source§

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

source§

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