Struct Vec3

Source
pub struct Vec3<T = f32>(pub T, pub T, pub T);
Expand description

A 3-dimensional vector.

Tuple Fields§

§0: T§1: T§2: T

Implementations§

Source§

impl<T> Vec3<T>
where T: Float,

Source

pub fn new() -> Vec3<T>

Creates a new instances.

Source

pub fn len(&self) -> T

Returns the length of the vector

Source

pub fn dot(&self, other: &Vec3<T>) -> T

Returns the dot-product of the vectors.

Trait Implementations§

Source§

impl<T> Add for Vec3<T>
where T: Float,

Source§

type Output = Vec3<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: Vec3<T>) -> Vec3<T>

Performs the + operation. Read more
Source§

impl<T> AddAssign for Vec3<T>
where T: Float,

Source§

fn add_assign(&mut self, other: Vec3<T>)

Performs the += operation. Read more
Source§

impl<T: Clone> Clone for Vec3<T>

Source§

fn clone(&self) -> Vec3<T>

Returns a duplicate 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<T> Debug for Vec3<T>
where T: Debug,

Source§

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

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

impl<T> Default for Vec3<T>
where T: Float,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> Div<T> for Vec3<T>
where T: Float,

Source§

fn div(self, other: T) -> Vec3<T>

Divides the vector by given scalar operand.

Source§

type Output = Vec3<T>

The resulting type after applying the / operator.
Source§

impl<T> Div for Vec3<T>
where T: Float,

Source§

fn div(self, other: Vec3<T>) -> Vec3<T>

Divides individual vector components with those of the given vector.

Source§

type Output = Vec3<T>

The resulting type after applying the / operator.
Source§

impl<T> DivAssign<T> for Vec3<T>
where T: Float,

Source§

fn div_assign(&mut self, other: T)

Mutates the vector by dividing it by given scalar.

Source§

impl<T> DivAssign for Vec3<T>
where T: Float,

Source§

fn div_assign(&mut self, other: Vec3<T>)

Mutates the vector by dividing its components with those of the given vector.

Source§

impl<T> From<[T; 3]> for Vec3<T>
where T: Copy,

Source§

fn from(source: [T; 3]) -> Self

Converts to this type from the input type.
Source§

impl<T> From<(T, T, T)> for Vec3<T>

Source§

fn from(source: (T, T, T)) -> Self

Converts to this type from the input type.
Source§

impl From<Vec3<f64>> for [f64; 3]

Source§

fn from(source: Vec3<f64>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec3<f64>> for (f64, f64, f64)

Source§

fn from(source: Vec3<f64>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec3> for [f32; 3]

Source§

fn from(source: Vec3<f32>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec3> for (f32, f32, f32)

Source§

fn from(source: Vec3<f32>) -> Self

Converts to this type from the input type.
Source§

impl<T> Mul<T> for Vec3<T>
where T: Float,

Source§

fn mul(self, other: T) -> Vec3<T>

Multiplies the vector with given scalar operand.

Source§

type Output = Vec3<T>

The resulting type after applying the * operator.
Source§

impl<T> Mul<Vec3<T>> for Mat4<T>
where T: Float,

Source§

fn mul(self, other: Vec3<T>) -> Vec3<T>

Multiplies the matrix with given vector operand using 1 as w-component of the vector.

Source§

type Output = Vec3<T>

The resulting type after applying the * operator.
Source§

impl Mul<Vec3<f64>> for f64

Source§

type Output = Vec3<f64>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vec3<f64>) -> Vec3<f64>

Performs the * operation. Read more
Source§

impl Mul<Vec3> for f32

Source§

type Output = Vec3

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vec3<f32>) -> Vec3<f32>

Performs the * operation. Read more
Source§

impl<T> Mul for Vec3<T>
where T: Float,

Source§

fn mul(self, other: Vec3<T>) -> Vec3<T>

Multiplies individual vector components with those of the given vector.

Source§

type Output = Vec3<T>

The resulting type after applying the * operator.
Source§

impl<T> MulAssign<T> for Vec3<T>
where T: Float,

Source§

fn mul_assign(&mut self, other: T)

Mutates the vector by multiplying it with the scalar operand.

Source§

impl<T> MulAssign for Vec3<T>
where T: Float,

Source§

fn mul_assign(&mut self, other: Vec3<T>)

Mutates the vector by multiplying its components with those of the given vector.

Source§

impl<T> Neg for Vec3<T>
where T: Float,

Source§

type Output = Vec3<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Vec3<T>

Performs the unary - operation. Read more
Source§

impl<T> Sub for Vec3<T>
where T: Float,

Source§

type Output = Vec3<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Vec3<T>) -> Vec3<T>

Performs the - operation. Read more
Source§

impl<T> SubAssign for Vec3<T>
where T: Float,

Source§

fn sub_assign(&mut self, other: Vec3<T>)

Performs the -= operation. Read more
Source§

impl<T> Vector<T> for Vec3<T>
where T: Copy,

Source§

fn as_vec3(&self, _: T) -> Vec3<T>

Returns the given value as a Vec3
Source§

impl<T: Copy> Copy for Vec3<T>

Auto Trait Implementations§

§

impl<T> Freeze for Vec3<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Vec3<T>
where T: RefUnwindSafe,

§

impl<T> Send for Vec3<T>
where T: Send,

§

impl<T> Sync for Vec3<T>
where T: Sync,

§

impl<T> Unpin for Vec3<T>
where T: Unpin,

§

impl<T> UnwindSafe for Vec3<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where T: Clone,

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T> Vector<T> for T
where T: Copy,

Source§

fn as_vec3(&self, _: T) -> Vec3<T>

Returns the given value as a Vec3