[−][src]Trait webgl_matrix::Vector
The base Vector trait
Note that vector operations are permitted on slices. This is useful for WebGl vertex storages, where many vectors are stored in a single array. The caveat obviously is the potential for errors. Sadly there is no secure alternative for handling this use-case.
Associated Types
type VectorType
Required methods
fn zeros() -> Self::VectorType
Create a vector filled with zeros
fn ones() -> Self::VectorType
Create a vector filled with ones
fn mul(&self, rhs: &[f32]) -> Self::VectorType
Perform element-wise multiplication with the given right-hand-side operand
fn add(&self, rhs: &[f32]) -> Self::VectorType
Perform element-wise addition with the given right-hand-side operand
fn sub(&self, rhs: &[f32]) -> Self::VectorType
Perform element-wise substraction with the given right-hand-side operand
fn scale(&self, factor: f32) -> Self::VectorType
Scale the vector elment-wise by the given constant
fn mag(&self) -> f32
Calculate the magnitude of this vector
fn mag2(&self) -> f32
Calculate the squared magnitude of this vector
fn dot(&self, rhs: &[f32]) -> f32
Calculate the dot product of this vector and the given right-hand-side operand