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

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

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.

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