Trait mafs::Vec4

source ·
pub trait Vec4<S>where
    Self: VecOps<S>,
    S: Float,{
Show 20 methods // Required methods fn new(x: S, y: S, y: S, z: S) -> Self; fn as_array(&self) -> &[S; 4]; fn as_mut_array(&mut self) -> &mut [S; 4]; fn add_componentwise(&self, rhs: Self) -> Self; fn sub_componentwise(&self, rhs: Self) -> Self; fn mul_componentwise(&self, rhs: Self) -> Self; fn div_componentwise(&self, rhs: Self) -> Self; fn min_componentwise(&self, rhs: Self) -> Self; fn max_componentwise(&self, rhs: Self) -> Self; fn floor(&self) -> Self; fn min_reduce(&self) -> S; fn max_reduce(&self) -> S; fn eq_reduce(&self, rhs: Self) -> bool; fn dot(&self, rhs: Self) -> S; fn cross(&self, rhs: Self) -> Self; // Provided methods fn splat(value: S) -> Self { ... } fn norm(&self) -> S { ... } fn normalize(&self) -> Self { ... } fn point(x: S, y: S, z: S) -> Self { ... } fn direction(x: S, y: S, z: S) -> Self { ... }
}
Expand description

Methods on four-dimensional vectors.

  • S is the type of the vector’s components.

Required Methods§

source

fn new(x: S, y: S, y: S, z: S) -> Self

Create a new two-dimensional vector.

source

fn as_array(&self) -> &[S; 4]

Convert to an array. Can also use the indexing operator [].

source

fn as_mut_array(&mut self) -> &mut [S; 4]

Convert to a mutable array. Can also use the indexing operator[].

source

fn add_componentwise(&self, rhs: Self) -> Self

Add component by component. Can also use the + operator.

source

fn sub_componentwise(&self, rhs: Self) -> Self

Subtract component by component. Can also use the - operator.

source

fn mul_componentwise(&self, rhs: Self) -> Self

Multiply component by component. Can also use the * operator.

source

fn div_componentwise(&self, rhs: Self) -> Self

Divide component by component. Can also use the / operator.

source

fn min_componentwise(&self, rhs: Self) -> Self

For each lane, select the smallest component of the two.

source

fn max_componentwise(&self, rhs: Self) -> Self

For each lane, select the largest component of the two.

source

fn floor(&self) -> Self

Round down all components to an integer value.

source

fn min_reduce(&self) -> S

Smallest of the four components.

source

fn max_reduce(&self) -> S

Largest of the four components.

source

fn eq_reduce(&self, rhs: Self) -> bool

Equality of a vector to another on all components.

source

fn dot(&self, rhs: Self) -> S

Dot product.

source

fn cross(&self, rhs: Self) -> Self

Cross product. The fourth component of the operands is ignored and the fourth component of the result will be zero.

Provided Methods§

source

fn splat(value: S) -> Self

Create a two-dimensional vector with all equal components.

source

fn norm(&self) -> S

Norm of this vector.

source

fn normalize(&self) -> Self

Divide by the norm to obain a normalized vector.

source

fn point(x: S, y: S, z: S) -> Self

Create a point in 3D space, i.e. the fourth component is 1.

source

fn direction(x: S, y: S, z: S) -> Self

Create a direction in 3D space, i.e. the fourth component is 0.

Implementors§