Skip to main content

TVector4

Struct TVector4 

Source
pub struct TVector4<T> {
    pub x: T,
    pub y: T,
    pub z: T,
    pub w: T,
}

Fields§

§x: T§y: T§z: T§w: T

Implementations§

Source§

impl<T> TVector4<T>
where T: Zero<T> + Copy,

Source

pub fn empty() -> Self

Creates TVector4<type> whose x, y, z and w equal to zero

use iomath::vectors::Vector4;
 
let vector = Vector4::empty();
assert_eq!(vector, Vector4 { x: 0.0, y: 0.0, z: 0.0, w: 0.0 });
Source

pub fn new(x: T, y: T, z: T, w: T) -> Self

Creates TVector4<type> with x, y, z and w

use iomath::vectors::Vector4;
 
let vector = Vector4::new(3.7, -1.3, 0.5, 6.4);
assert_eq!(vector, Vector4 { x: 3.7, y: -1.3, z: 0.5, w: 6.4 });
Source

pub fn from_scalar(scalar: T) -> Self

Creates TVector4<type> whose x, y, z, and w equal to scalar

use iomath::vectors::Vector4;
 
let vector = Vector4::from_scalar(9.0);
assert_eq!(vector, Vector4::new(9.0, 9.0, 9.0, 9.0));
Source

pub fn from_two_values_vector( first_val: T, second_val: T, vector: TVector2<T>, ) -> Self

Creates TVector4<type> whose x equals to first value, y to second value, z and w to TVector2<type>’s x and y

use iomath::vectors::{ Vector4, Vector2 };
 
let vector = Vector4::from_two_values_vector(4.0, 5.0, Vector2::new(6.0, 7.0));
assert_eq!(vector, Vector4::new(4.0, 5.0, 6.0, 7.0));
Source

pub fn from_value_vector_value( first_val: T, vector: TVector2<T>, second_val: T, ) -> Self

Creates TVector4<type> whose x equals to first value,y and z to TVector2<type>’s x and y, w to second value

use iomath::vectors::{ Vector4, Vector2 };
 
let vector = Vector4::from_value_vector_value(4.0, Vector2::new(6.0, 7.0), 5.0);
assert_eq!(vector, Vector4::new(4.0, 6.0, 7.0, 5.0));
Source

pub fn from_vector_two_values( vector: TVector2<T>, first_val: T, second_val: T, ) -> Self

Creates TVector4<type> whose x and y equal to TVector2<type>’s x and y, z to first value, w to second value

use iomath::vectors::{ Vector4, Vector2 };
 
let vector = Vector4::from_vector_two_values(Vector2::new(6.0, 7.0), 4.0, 5.0);
assert_eq!(vector, Vector4::new(6.0, 7.0, 4.0, 5.0));
Source

pub fn from_two_vectors( first_vector: TVector2<T>, second_vector: TVector2<T>, ) -> Self

Creates TVector4<type> whose x and y equal to first TVector2<type>’s x and y, z and w to second TVector2<type>’s x and y

use iomath::vectors::{ Vector4, Vector2 };
 
let vector = Vector4::from_two_vectors(Vector2::new(4.0, 7.0), Vector2::new(5.0, 6.0));
assert_eq!(vector, Vector4::new(4.0, 7.0, 5.0, 6.0));
Source

pub fn from_value_vector(value: T, vector: TVector3<T>) -> Self

Creates TVector4<type> whose x equals to value, y, z and w equal to TVector3<type>’s x, y and z

use iomath::vectors::{ Vector4, Vector3 };
 
let vector = Vector4::from_value_vector(1.7, Vector3::new(1.4, 5.5, 2.3));
assert_eq!(vector, Vector4::new(1.7, 1.4, 5.5, 2.3));
Source

pub fn from_vector_value(vector: TVector3<T>, value: T) -> Self

Creates TVector4<type> whose x, y and z equal to TVector3<type>’s x, y and z, w equals to value

use iomath::vectors::{ Vector4, Vector3 };
 
let vector = Vector4::from_vector_value(Vector3::new(1.4, 5.5, 2.3), 1.7);
assert_eq!(vector, Vector4::new(1.4, 5.5, 2.3, 1.7));

Trait Implementations§

Source§

impl<T> Add<T> for TVector4<T>
where T: Add<Output = T> + Copy,

Source§

type Output = TVector4<T>

The resulting type after applying the + operator.
Source§

fn add(self, scalar: T) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add for TVector4<T>
where T: Add<Output = T>,

Source§

type Output = TVector4<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T> AddAssign<T> for TVector4<T>
where T: AddAssign + Copy,

Source§

fn add_assign(&mut self, scalar: T)

Performs the += operation. Read more
Source§

impl<T> AddAssign for TVector4<T>
where T: AddAssign,

Source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
Source§

impl<T> BitAnd<T> for TVector4<T>
where T: BitAnd<Output = T> + Copy,

Source§

type Output = TVector4<T>

The resulting type after applying the & operator.
Source§

fn bitand(self, scalar: T) -> Self::Output

Performs the & operation. Read more
Source§

impl<T> BitAnd for TVector4<T>
where T: BitAnd<Output = T>,

Source§

type Output = TVector4<T>

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl<T> BitAndAssign<T> for TVector4<T>
where T: BitAndAssign + Copy,

Source§

fn bitand_assign(&mut self, scalar: T)

Performs the &= operation. Read more
Source§

impl<T> BitAndAssign for TVector4<T>
where T: BitAndAssign,

Source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
Source§

impl<T> BitOr<T> for TVector4<T>
where T: BitOr<Output = T> + Copy,

Source§

type Output = TVector4<T>

The resulting type after applying the | operator.
Source§

fn bitor(self, scalar: T) -> Self::Output

Performs the | operation. Read more
Source§

impl<T> BitOr for TVector4<T>
where T: BitOr<Output = T>,

Source§

type Output = TVector4<T>

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl<T> BitOrAssign<T> for TVector4<T>
where T: BitOrAssign + Copy,

Source§

fn bitor_assign(&mut self, scalar: T)

Performs the |= operation. Read more
Source§

impl<T> BitOrAssign for TVector4<T>
where T: BitOrAssign,

Source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
Source§

impl<T> BitXor<T> for TVector4<T>
where T: BitXor<Output = T> + Copy,

Source§

type Output = TVector4<T>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, scalar: T) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<T> BitXor for TVector4<T>
where T: BitXor<Output = T>,

Source§

type Output = TVector4<T>

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl<T> BitXorAssign<T> for TVector4<T>
where T: BitXorAssign + Copy,

Source§

fn bitxor_assign(&mut self, scalar: T)

Performs the ^= operation. Read more
Source§

impl<T> BitXorAssign for TVector4<T>
where T: BitXorAssign,

Source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
Source§

impl<T> Clone for TVector4<T>
where T: Copy,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for TVector4<T>
where T: Debug,

Source§

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

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

impl<T> Div<T> for TVector4<T>
where T: Div<Output = T> + Copy,

Source§

type Output = TVector4<T>

The resulting type after applying the / operator.
Source§

fn div(self, scalar: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div for TVector4<T>
where T: Div<Output = T>,

Source§

type Output = TVector4<T>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<T> DivAssign<T> for TVector4<T>
where T: DivAssign + Copy,

Source§

fn div_assign(&mut self, scalar: T)

Performs the /= operation. Read more
Source§

impl<T> DivAssign for TVector4<T>
where T: DivAssign,

Source§

fn div_assign(&mut self, other: Self)

Performs the /= operation. Read more
Source§

impl<T> From<TQuaternion<T>> for TVector4<T>

Source§

fn from(quat: TQuaternion<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<TVector2<T>> for TVector4<T>
where T: Zero<T>,

Source§

fn from(vector: TVector2<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<TVector3<T>> for TVector4<T>
where T: Zero<T>,

Source§

fn from(vector: TVector3<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<TVector4<T>> for TVector2<T>

Source§

fn from(vector: TVector4<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<TVector4<T>> for TVector3<T>

Source§

fn from(vector: TVector4<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> Index<usize> for TVector4<T>

Source§

type Output = T

The returned type after indexing.
Source§

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

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

impl<T> IndexMut<usize> for TVector4<T>

Source§

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

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

impl<T> Mul<T> for TVector4<T>
where T: Mul<Output = T> + Copy,

Source§

type Output = TVector4<T>

The resulting type after applying the * operator.
Source§

fn mul(self, scalar: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul for TVector4<T>
where T: Mul<Output = T>,

Source§

type Output = TVector4<T>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T> MulAssign<T> for TVector4<T>
where T: MulAssign + Copy,

Source§

fn mul_assign(&mut self, scalar: T)

Performs the *= operation. Read more
Source§

impl<T> MulAssign for TVector4<T>
where T: MulAssign,

Source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
Source§

impl<T> Neg for TVector4<T>
where T: Neg<Output = T>,

Source§

type Output = TVector4<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T> PartialEq for TVector4<T>
where T: PartialEq,

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Rem<T> for TVector4<T>
where T: Rem<Output = T> + Copy,

Source§

type Output = TVector4<T>

The resulting type after applying the % operator.
Source§

fn rem(self, scalar: T) -> Self::Output

Performs the % operation. Read more
Source§

impl<T> Rem for TVector4<T>
where T: Rem<Output = T>,

Source§

type Output = TVector4<T>

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

impl<T> RemAssign<T> for TVector4<T>
where T: RemAssign + Copy,

Source§

fn rem_assign(&mut self, scalar: T)

Performs the %= operation. Read more
Source§

impl<T> RemAssign for TVector4<T>
where T: RemAssign,

Source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation. Read more
Source§

impl<T> Shl<T> for TVector4<T>
where T: Shl<Output = T> + Copy,

Source§

type Output = TVector4<T>

The resulting type after applying the << operator.
Source§

fn shl(self, scalar: T) -> Self::Output

Performs the << operation. Read more
Source§

impl<T> Shl for TVector4<T>
where T: Shl<Output = T>,

Source§

type Output = TVector4<T>

The resulting type after applying the << operator.
Source§

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

Performs the << operation. Read more
Source§

impl<T> ShlAssign<T> for TVector4<T>
where T: ShlAssign + Copy,

Source§

fn shl_assign(&mut self, scalar: T)

Performs the <<= operation. Read more
Source§

impl<T> ShlAssign for TVector4<T>
where T: ShlAssign,

Source§

fn shl_assign(&mut self, rhs: Self)

Performs the <<= operation. Read more
Source§

impl<T> Shr<T> for TVector4<T>
where T: Shr<Output = T> + Copy,

Source§

type Output = TVector4<T>

The resulting type after applying the >> operator.
Source§

fn shr(self, scalar: T) -> Self::Output

Performs the >> operation. Read more
Source§

impl<T> Shr for TVector4<T>
where T: Shr<Output = T>,

Source§

type Output = TVector4<T>

The resulting type after applying the >> operator.
Source§

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

Performs the >> operation. Read more
Source§

impl<T> ShrAssign<T> for TVector4<T>
where T: ShrAssign + Copy,

Source§

fn shr_assign(&mut self, scalar: T)

Performs the >>= operation. Read more
Source§

impl<T> ShrAssign for TVector4<T>
where T: ShrAssign,

Source§

fn shr_assign(&mut self, rhs: Self)

Performs the >>= operation. Read more
Source§

impl<T> Sub<T> for TVector4<T>
where T: Sub<Output = T> + Copy,

Source§

type Output = TVector4<T>

The resulting type after applying the - operator.
Source§

fn sub(self, scalar: T) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub for TVector4<T>
where T: Sub<Output = T>,

Source§

type Output = TVector4<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T> SubAssign<T> for TVector4<T>
where T: SubAssign + Copy,

Source§

fn sub_assign(&mut self, scalar: T)

Performs the -= operation. Read more
Source§

impl<T> SubAssign for TVector4<T>
where T: SubAssign,

Source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
Source§

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

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<T> UnsafeUnpin for TVector4<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for TVector4<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.