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

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§