Struct slender_math::Vector3f

source ·
#[repr(C, align(16))]
pub struct Vector3f(_);
Expand description

A vector with 3 f32 components

Implementations§

source§

impl Vector3f

source

pub const ZERO: Self = _

The vector (0, 0, 0)

source

pub const ONE: Self = _

The vector (1, 1, 1)

source

pub const UNIT_X: Self = _

The vector (1, 0, 0)

source

pub const UNIT_Y: Self = _

The vector (0, 1, 0)

source

pub const UNIT_Z: Self = _

The vector (0, 0, 1)

source

pub const fn x(&self) -> f32

The x component of the vector

source

pub fn x_mut(&mut self) -> &mut f32

The x component of the vector

source

pub const fn y(&self) -> f32

The y component of the vector

source

pub fn y_mut(&mut self) -> &mut f32

The y component of the vector

source

pub const fn z(&self) -> f32

The z component of the vector

source

pub fn z_mut(&mut self) -> &mut f32

The z component of the vector

source

pub const fn r(&self) -> f32

The r component of the vector

source

pub fn r_mut(&mut self) -> &mut f32

The r component of the vector

source

pub const fn g(&self) -> f32

The g component of the vector

source

pub fn g_mut(&mut self) -> &mut f32

The g component of the vector

source

pub const fn b(&self) -> f32

The b component of the vector

source

pub fn b_mut(&mut self) -> &mut f32

The b component of the vector

source

pub const fn new(x: f32, y: f32, z: f32) -> Self

Creates a new vector from the given components

source

pub const fn from_scalar(scalar: f32) -> Self

Creates a new vector by setting all components to the given scalar

source

pub const fn from_array(array: [f32; 3]) -> Self

Creates a new vector from the given array

source

pub const fn from_v2f(v: v2f, z: f32) -> Self

Creates a new vector from the given 2-component vector

source

pub const fn to_array(&self) -> [f32; 3]

Converts the vector into an array

source

pub const fn as_array(&self) -> &[f32; 3]

Returns an array reference to the vector

source

pub fn as_mut_array(&mut self) -> &mut [f32; 3]

Returns a mutable array reference to the vector

source

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

Calculates the cross product between this vector and rhs

source§

impl Vector3f

source

pub fn abs(self) -> Self

Returns a vector with each component set to the absolute value of the corresponding component in this vector

source

pub fn recip(self) -> Self

Returns a vector with each component set to the reciprocal of the corresponding component in this vector

source

pub fn floor(self) -> Self

Returns a vector with each component set to the floor of the corresponding component in this vector

source

pub fn ceil(self) -> Self

Returns a vector with each component set to the ceiling of the corresponding component in this vector

source

pub fn fract(self) -> Self

Returns a vector with each component set to the fractional part of the corresponding component in this vector

source

pub fn dot(self, rhs: Self) -> f32

Calculates the dot product between this vector and rhs

source

pub fn len2(self) -> f32

The length of this vector squared

source

pub fn len(self) -> f32

The length of this vector

source

pub fn normalized(self) -> Self

Normalizes the vector

source

pub fn lerp(self, rhs: Self, t: f32) -> Self

Linearily interpolates between this vector and rhs

source

pub fn dist2(self, b: Self) -> f32

Calculates the distance between this vector and rhs squared

source

pub fn dist(self, b: Self) -> f32

Calculates the distance between this vector and rhs

source

pub fn min(self, rhs: Self) -> Self

Returns a vector with each component set to the minimum of the corresponding components between this vector and rhs

source

pub fn max(self, rhs: Self) -> Self

Returns a vector with each component set to the maximum of the corresponding components between this vector and rhs

source

pub fn mul_add(self, a: Self, b: Self) -> Self

Calculates (self * a) + b in one operation

§

impl Vector3f

pub fn xx(&self) -> Vector2f

pub fn rr(&self) -> Vector2f

pub fn xy(&self) -> Vector2f

pub fn rg(&self) -> Vector2f

pub fn xz(&self) -> Vector2f

pub fn rb(&self) -> Vector2f

pub fn yx(&self) -> Vector2f

pub fn gr(&self) -> Vector2f

pub fn yy(&self) -> Vector2f

pub fn gg(&self) -> Vector2f

pub fn yz(&self) -> Vector2f

pub fn gb(&self) -> Vector2f

pub fn zx(&self) -> Vector2f

pub fn br(&self) -> Vector2f

pub fn zy(&self) -> Vector2f

pub fn bg(&self) -> Vector2f

pub fn zz(&self) -> Vector2f

pub fn bb(&self) -> Vector2f

pub fn xxx(&self) -> Vector3f

pub fn rrr(&self) -> Vector3f

pub fn xxy(&self) -> Vector3f

pub fn rrg(&self) -> Vector3f

pub fn xxz(&self) -> Vector3f

pub fn rrb(&self) -> Vector3f

pub fn xyx(&self) -> Vector3f

pub fn rgr(&self) -> Vector3f

pub fn xyy(&self) -> Vector3f

pub fn rgg(&self) -> Vector3f

pub fn xyz(&self) -> Vector3f

pub fn rgb(&self) -> Vector3f

pub fn xzx(&self) -> Vector3f

pub fn rbr(&self) -> Vector3f

pub fn xzy(&self) -> Vector3f

pub fn rbg(&self) -> Vector3f

pub fn xzz(&self) -> Vector3f

pub fn rbb(&self) -> Vector3f

pub fn yxx(&self) -> Vector3f

pub fn grr(&self) -> Vector3f

pub fn yxy(&self) -> Vector3f

pub fn grg(&self) -> Vector3f

pub fn yxz(&self) -> Vector3f

pub fn grb(&self) -> Vector3f

pub fn yyx(&self) -> Vector3f

pub fn ggr(&self) -> Vector3f

pub fn yyy(&self) -> Vector3f

pub fn ggg(&self) -> Vector3f

pub fn yyz(&self) -> Vector3f

pub fn ggb(&self) -> Vector3f

pub fn yzx(&self) -> Vector3f

pub fn gbr(&self) -> Vector3f

pub fn yzy(&self) -> Vector3f

pub fn gbg(&self) -> Vector3f

pub fn yzz(&self) -> Vector3f

pub fn gbb(&self) -> Vector3f

pub fn zxx(&self) -> Vector3f

pub fn brr(&self) -> Vector3f

pub fn zxy(&self) -> Vector3f

pub fn brg(&self) -> Vector3f

pub fn zxz(&self) -> Vector3f

pub fn brb(&self) -> Vector3f

pub fn zyx(&self) -> Vector3f

pub fn bgr(&self) -> Vector3f

pub fn zyy(&self) -> Vector3f

pub fn bgg(&self) -> Vector3f

pub fn zyz(&self) -> Vector3f

pub fn bgb(&self) -> Vector3f

pub fn zzx(&self) -> Vector3f

pub fn bbr(&self) -> Vector3f

pub fn zzy(&self) -> Vector3f

pub fn bbg(&self) -> Vector3f

pub fn zzz(&self) -> Vector3f

pub fn bbb(&self) -> Vector3f

pub fn xxxx(&self) -> Vector4f

pub fn rrrr(&self) -> Vector4f

pub fn xxxy(&self) -> Vector4f

pub fn rrrg(&self) -> Vector4f

pub fn xxxz(&self) -> Vector4f

pub fn rrrb(&self) -> Vector4f

pub fn xxyx(&self) -> Vector4f

pub fn rrgr(&self) -> Vector4f

pub fn xxyy(&self) -> Vector4f

pub fn rrgg(&self) -> Vector4f

pub fn xxyz(&self) -> Vector4f

pub fn rrgb(&self) -> Vector4f

pub fn xxzx(&self) -> Vector4f

pub fn rrbr(&self) -> Vector4f

pub fn xxzy(&self) -> Vector4f

pub fn rrbg(&self) -> Vector4f

pub fn xxzz(&self) -> Vector4f

pub fn rrbb(&self) -> Vector4f

pub fn xyxx(&self) -> Vector4f

pub fn rgrr(&self) -> Vector4f

pub fn xyxy(&self) -> Vector4f

pub fn rgrg(&self) -> Vector4f

pub fn xyxz(&self) -> Vector4f

pub fn rgrb(&self) -> Vector4f

pub fn xyyx(&self) -> Vector4f

pub fn rggr(&self) -> Vector4f

pub fn xyyy(&self) -> Vector4f

pub fn rggg(&self) -> Vector4f

pub fn xyyz(&self) -> Vector4f

pub fn rggb(&self) -> Vector4f

pub fn xyzx(&self) -> Vector4f

pub fn rgbr(&self) -> Vector4f

pub fn xyzy(&self) -> Vector4f

pub fn rgbg(&self) -> Vector4f

pub fn xyzz(&self) -> Vector4f

pub fn rgbb(&self) -> Vector4f

pub fn xzxx(&self) -> Vector4f

pub fn rbrr(&self) -> Vector4f

pub fn xzxy(&self) -> Vector4f

pub fn rbrg(&self) -> Vector4f

pub fn xzxz(&self) -> Vector4f

pub fn rbrb(&self) -> Vector4f

pub fn xzyx(&self) -> Vector4f

pub fn rbgr(&self) -> Vector4f

pub fn xzyy(&self) -> Vector4f

pub fn rbgg(&self) -> Vector4f

pub fn xzyz(&self) -> Vector4f

pub fn rbgb(&self) -> Vector4f

pub fn xzzx(&self) -> Vector4f

pub fn rbbr(&self) -> Vector4f

pub fn xzzy(&self) -> Vector4f

pub fn rbbg(&self) -> Vector4f

pub fn xzzz(&self) -> Vector4f

pub fn rbbb(&self) -> Vector4f

pub fn yxxx(&self) -> Vector4f

pub fn grrr(&self) -> Vector4f

pub fn yxxy(&self) -> Vector4f

pub fn grrg(&self) -> Vector4f

pub fn yxxz(&self) -> Vector4f

pub fn grrb(&self) -> Vector4f

pub fn yxyx(&self) -> Vector4f

pub fn grgr(&self) -> Vector4f

pub fn yxyy(&self) -> Vector4f

pub fn grgg(&self) -> Vector4f

pub fn yxyz(&self) -> Vector4f

pub fn grgb(&self) -> Vector4f

pub fn yxzx(&self) -> Vector4f

pub fn grbr(&self) -> Vector4f

pub fn yxzy(&self) -> Vector4f

pub fn grbg(&self) -> Vector4f

pub fn yxzz(&self) -> Vector4f

pub fn grbb(&self) -> Vector4f

pub fn yyxx(&self) -> Vector4f

pub fn ggrr(&self) -> Vector4f

pub fn yyxy(&self) -> Vector4f

pub fn ggrg(&self) -> Vector4f

pub fn yyxz(&self) -> Vector4f

pub fn ggrb(&self) -> Vector4f

pub fn yyyx(&self) -> Vector4f

pub fn gggr(&self) -> Vector4f

pub fn yyyy(&self) -> Vector4f

pub fn gggg(&self) -> Vector4f

pub fn yyyz(&self) -> Vector4f

pub fn gggb(&self) -> Vector4f

pub fn yyzx(&self) -> Vector4f

pub fn ggbr(&self) -> Vector4f

pub fn yyzy(&self) -> Vector4f

pub fn ggbg(&self) -> Vector4f

pub fn yyzz(&self) -> Vector4f

pub fn ggbb(&self) -> Vector4f

pub fn yzxx(&self) -> Vector4f

pub fn gbrr(&self) -> Vector4f

pub fn yzxy(&self) -> Vector4f

pub fn gbrg(&self) -> Vector4f

pub fn yzxz(&self) -> Vector4f

pub fn gbrb(&self) -> Vector4f

pub fn yzyx(&self) -> Vector4f

pub fn gbgr(&self) -> Vector4f

pub fn yzyy(&self) -> Vector4f

pub fn gbgg(&self) -> Vector4f

pub fn yzyz(&self) -> Vector4f

pub fn gbgb(&self) -> Vector4f

pub fn yzzx(&self) -> Vector4f

pub fn gbbr(&self) -> Vector4f

pub fn yzzy(&self) -> Vector4f

pub fn gbbg(&self) -> Vector4f

pub fn yzzz(&self) -> Vector4f

pub fn gbbb(&self) -> Vector4f

pub fn zxxx(&self) -> Vector4f

pub fn brrr(&self) -> Vector4f

pub fn zxxy(&self) -> Vector4f

pub fn brrg(&self) -> Vector4f

pub fn zxxz(&self) -> Vector4f

pub fn brrb(&self) -> Vector4f

pub fn zxyx(&self) -> Vector4f

pub fn brgr(&self) -> Vector4f

pub fn zxyy(&self) -> Vector4f

pub fn brgg(&self) -> Vector4f

pub fn zxyz(&self) -> Vector4f

pub fn brgb(&self) -> Vector4f

pub fn zxzx(&self) -> Vector4f

pub fn brbr(&self) -> Vector4f

pub fn zxzy(&self) -> Vector4f

pub fn brbg(&self) -> Vector4f

pub fn zxzz(&self) -> Vector4f

pub fn brbb(&self) -> Vector4f

pub fn zyxx(&self) -> Vector4f

pub fn bgrr(&self) -> Vector4f

pub fn zyxy(&self) -> Vector4f

pub fn bgrg(&self) -> Vector4f

pub fn zyxz(&self) -> Vector4f

pub fn bgrb(&self) -> Vector4f

pub fn zyyx(&self) -> Vector4f

pub fn bggr(&self) -> Vector4f

pub fn zyyy(&self) -> Vector4f

pub fn bggg(&self) -> Vector4f

pub fn zyyz(&self) -> Vector4f

pub fn bggb(&self) -> Vector4f

pub fn zyzx(&self) -> Vector4f

pub fn bgbr(&self) -> Vector4f

pub fn zyzy(&self) -> Vector4f

pub fn bgbg(&self) -> Vector4f

pub fn zyzz(&self) -> Vector4f

pub fn bgbb(&self) -> Vector4f

pub fn zzxx(&self) -> Vector4f

pub fn bbrr(&self) -> Vector4f

pub fn zzxy(&self) -> Vector4f

pub fn bbrg(&self) -> Vector4f

pub fn zzxz(&self) -> Vector4f

pub fn bbrb(&self) -> Vector4f

pub fn zzyx(&self) -> Vector4f

pub fn bbgr(&self) -> Vector4f

pub fn zzyy(&self) -> Vector4f

pub fn bbgg(&self) -> Vector4f

pub fn zzyz(&self) -> Vector4f

pub fn bbgb(&self) -> Vector4f

pub fn zzzx(&self) -> Vector4f

pub fn bbbr(&self) -> Vector4f

pub fn zzzy(&self) -> Vector4f

pub fn bbbg(&self) -> Vector4f

pub fn zzzz(&self) -> Vector4f

pub fn bbbb(&self) -> Vector4f

Trait Implementations§

source§

impl Add<Vector3f> for Vector3f

§

type Output = Vector3f

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl Add<f32> for Vector3f

§

type Output = Vector3f

The resulting type after applying the + operator.
source§

fn add(self, rhs: f32) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign<Vector3f> for Vector3f

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl AddAssign<f32> for Vector3f

source§

fn add_assign(&mut self, rhs: f32)

Performs the += operation. Read more
source§

impl AsMut<[f32; 3]> for Vector3f

source§

fn as_mut(&mut self) -> &mut [f32; 3]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<[f32; 3]> for Vector3f

source§

fn as_ref(&self) -> &[f32; 3]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<[f32; 3]> for Vector3f

source§

fn borrow(&self) -> &[f32; 3]

Immutably borrows from an owned value. Read more
source§

impl BorrowMut<[f32; 3]> for Vector3f

source§

fn borrow_mut(&mut self) -> &mut [f32; 3]

Mutably borrows from an owned value. Read more
source§

impl Clone for Vector3f

source§

fn clone(&self) -> Vector3f

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Vector3f

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Vector3f

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Div<Vector3f> for Vector3f

§

type Output = Vector3f

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
source§

impl Div<f32> for Vector3f

§

type Output = Vector3f

The resulting type after applying the / operator.
source§

fn div(self, rhs: f32) -> Self::Output

Performs the / operation. Read more
source§

impl DivAssign<Vector3f> for Vector3f

source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
source§

impl DivAssign<f32> for Vector3f

source§

fn div_assign(&mut self, rhs: f32)

Performs the /= operation. Read more
source§

impl From<[f32; 3]> for Vector3f

source§

fn from(a: [f32; 3]) -> Self

Converts to this type from the input type.
source§

impl Index<usize> for Vector3f

§

type Output = f32

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<usize> for Vector3f

source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl Into<[f32; 3]> for Vector3f

source§

fn into(self) -> [f32; 3]

Converts this type into the (usually inferred) input type.
source§

impl Mul<Vector3f> for Matrix4x4

§

type Output = Vector3f

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Vector3f) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Vector3f> for Quaternion

§

type Output = Vector3f

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Vector3f) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Vector3f> for Vector3f

§

type Output = Vector3f

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<f32> for Vector3f

§

type Output = Vector3f

The resulting type after applying the * operator.
source§

fn mul(self, rhs: f32) -> Self::Output

Performs the * operation. Read more
source§

impl MulAssign<Vector3f> for Vector3f

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl MulAssign<f32> for Vector3f

source§

fn mul_assign(&mut self, rhs: f32)

Performs the *= operation. Read more
source§

impl Neg for Vector3f

§

type Output = Vector3f

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl PartialEq<Vector3f> for Vector3f

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Rem<Vector3f> for Vector3f

§

type Output = Vector3f

The resulting type after applying the % operator.
source§

fn rem(self, rhs: Self) -> Self::Output

Performs the % operation. Read more
source§

impl Rem<f32> for Vector3f

§

type Output = Vector3f

The resulting type after applying the % operator.
source§

fn rem(self, rhs: f32) -> Self::Output

Performs the % operation. Read more
source§

impl RemAssign<Vector3f> for Vector3f

source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation. Read more
source§

impl RemAssign<f32> for Vector3f

source§

fn rem_assign(&mut self, rhs: f32)

Performs the %= operation. Read more
source§

impl Sub<Vector3f> for Vector3f

§

type Output = Vector3f

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<f32> for Vector3f

§

type Output = Vector3f

The resulting type after applying the - operator.
source§

fn sub(self, rhs: f32) -> Self::Output

Performs the - operation. Read more
source§

impl SubAssign<Vector3f> for Vector3f

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl SubAssign<f32> for Vector3f

source§

fn sub_assign(&mut self, rhs: f32)

Performs the -= operation. Read more
source§

impl Zeroable for Vector3f

source§

fn zeroed() -> Self

source§

impl Copy for Vector3f

source§

impl Pod for Vector3f

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CheckedBitPattern for Twhere T: AnyBitPattern,

§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> AnyBitPattern for Twhere T: Pod,

source§

impl<T> NoUninit for Twhere T: Pod,