Type Alias Vec3

Source
pub type Vec3 = [f32; 3];

Trait Implementations§

Source§

impl MulVectorMatrix<[f32; 16]> for Vec3

Source§

fn mul_matrix_left(&self, lhs: &Mat4) -> Self::VectorType

Interprets self as a column vector with the 4th component equal to 1 and multiplies the given matrix from the left-hand-side, i.e. lhs * [...self, 1.0]

Source§

fn mul_matrix(&self, rhs: &Mat4) -> Self::VectorType

Interprets self as a row vector with the 4th component equal to 1 and multiplies the given matrix from the right-hand-side, i.e. [...self, 1.0] * rhs

Source§

type VectorType = [f32; 4]

Source§

impl MulVectorMatrix<[f32; 9]> for Vec3

Source§

type VectorType = [f32; 3]

Source§

fn mul_matrix_left(&self, lhs: &Mat3) -> Self::VectorType

Interprets self as a column vector and multiplies the given matrix from the left-hand-side, i.e. lhs * self
Source§

fn mul_matrix(&self, rhs: &Mat3) -> Self::VectorType

Interprets self as a row vector and multiplies the given matrix from the right-hand-side, i.e. self * rhs
Source§

impl Vector for Vec3

Source§

type VectorType = [f32; 3]

Source§

fn zeros() -> Vec3

Create a vector filled with zeros
Source§

fn ones() -> Vec3

Create a vector filled with ones
Source§

fn mul(&self, rhs: &[f32]) -> Vec3

Perform element-wise multiplication with the given right-hand-side operand
Source§

fn add(&self, rhs: &[f32]) -> Vec3

Perform element-wise addition with the given right-hand-side operand
Source§

fn sub(&self, rhs: &[f32]) -> Vec3

Perform element-wise substraction with the given right-hand-side operand
Source§

fn scale(&self, factor: f32) -> Vec3

Scale the vector elment-wise by the given constant
Source§

fn mag(&self) -> f32

Calculate the magnitude of this vector
Source§

fn mag2(&self) -> f32

Calculate the squared magnitude of this vector
Source§

fn dot(&self, rhs: &[f32]) -> f32

Calculate the dot product of this vector and the given right-hand-side operand