Trait Vec4Ext

Source
pub trait Vec4Ext {
    // Required methods
    fn trunc(self) -> Self;
    fn step(self, value: Self) -> Self;
    fn step_select(self, value: Self, true_: Self, false_: Self) -> Self;
    fn fract(self) -> Self;
    fn sqrt(self) -> Self;
    fn to_bits(self) -> UVec4;
    fn mean(self) -> f32;
    fn has_equal_components(self, max_abs_diff: f32) -> bool;
}
Expand description

Extensions to Vec4

Adds additional functionality to Vec4 that glam doesn’t have.

Required Methods§

Source

fn trunc(self) -> Self

For element i of self, return v[i].trunc()

Source

fn step(self, value: Self) -> Self

For element i of the return value, returns 0.0 if value[i] < self[i] and 1.0 otherwise.

Similar to glsl’s step(edge, x), which translates into edge.step(x)

Source

fn step_select(self, value: Self, true_: Self, false_: Self) -> Self

Selects between true and false based on the result of value[i] < self[i]

Source

fn fract(self) -> Self

Return only the fractional parts of each component.

Source

fn sqrt(self) -> Self

Return the square root of each component.

Source

fn to_bits(self) -> UVec4

Raw transmute each component to u32.

Source

fn mean(self) -> f32

Get the mean value of all four components

Source

fn has_equal_components(self, max_abs_diff: f32) -> bool

Returns true if all components of the vector is the same within an absolute difference of max_abs_diff

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.

Implementations on Foreign Types§

Source§

impl Vec4Ext for Vec4

Source§

fn trunc(self) -> Self

Source§

fn step(self, value: Self) -> Self

Source§

fn step_select(self, value: Self, less: Self, greater_or_equal: Self) -> Self

Source§

fn fract(self) -> Self

Source§

fn sqrt(self) -> Self

Source§

fn to_bits(self) -> UVec4

Source§

fn mean(self) -> f32

Source§

fn has_equal_components(self, max_abs_diff: f32) -> bool

Implementors§