Skip to main content

VectorExt

Trait VectorExt 

Source
pub trait VectorExt: Sized + Copy {
    // Required methods
    fn ith(i: usize, val: f32) -> Self;
    fn angle(self, other: Self) -> f32;
    fn kronecker(self, other: Self) -> Matrix;
    fn vget(&self, i: usize) -> f32;
    fn vset(&mut self, i: usize, val: f32);
}
Expand description

Extension trait for glam vector types to provide additional functionality.

Required Methods§

Source

fn ith(i: usize, val: f32) -> Self

Creates a vector with the i-th component set to val and all others to zero.

Source

fn angle(self, other: Self) -> f32

Computes the angle between two vectors in radians.

Source

fn kronecker(self, other: Self) -> Matrix

Computes the kronecker product between two vectors.

Source

fn vget(&self, i: usize) -> f32

Gets the i-th component of the vector by index.

This is a SPIR-V compatible replacement for bracket indexing (v[i]), which is not supported on glam types when targeting SPIR-V.

Source

fn vset(&mut self, i: usize, val: f32)

Sets the i-th component of the vector by index.

This is a SPIR-V compatible replacement for bracket indexing (v[i] = val), which is not supported on glam types when targeting SPIR-V.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§