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