Struct Vector4

Source
pub struct Vector4 {
    pub x: f64,
    pub y: f64,
    pub z: f64,
    pub w: f64,
}
Expand description

4D vectors (x, y, z, w)

Fields§

§x: f64§y: f64§z: f64§w: f64

Implementations§

Source§

impl Vector4

Source

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

Trait Implementations§

Source§

impl Add<Vector4> for Point2

Source§

type Output = Point<Vector2>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add for Vector4

Source§

type Output = Vector4

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl AddAssign<Vector4> for Point2

Source§

fn add_assign(&mut self, rhs: Vector4)

Performs the += operation. Read more
Source§

impl AddAssign for Vector4

Source§

fn add_assign(&mut self, rhs: Vector4)

Performs the += operation. Read more
Source§

impl Array<[f64; 4]> for Vector4

Source§

fn to_array(&self) -> [f64; 4]

Convert the object to array
Source§

fn set_array(&mut self, array: &[f64; 4]) -> &mut Self

Set the object from array
Source§

impl BitOr for Vector4

Source§

type Output = f64

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl Clone for Vector4

Source§

fn clone(&self) -> Vector4

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 Debug for Vector4

Source§

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

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

impl Div<f64> for Vector4

Source§

type Output = Vector4

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl DivAssign<f64> for Vector4

Source§

fn div_assign(&mut self, rhs: f64)

Performs the /= operation. Read more
Source§

impl From<[f64; 4]> for Vector4

Source§

fn from(array: [f64; 4]) -> Self

Converts to this type from the input type.
Source§

impl From<Point<Vector2>> for Vector4

Source§

fn from(point: Point2) -> Self

Converts to this type from the input type.
Source§

impl From<Vector4> for Point2

Source§

fn from(vector: Vector4) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Vector4

Source§

fn from(s: f64) -> Self

Converts to this type from the input type.
Source§

impl Homogeneous<Vector4> for Vector3

Source§

fn from_homogeneous(vector: &Vector4) -> Self

Get a inhomogeneous vector from an homogeneous vector Read more
Source§

fn to_homogeneous(&self) -> Vector4

Get a vector transformed to an homogeneous vector Read more
Source§

impl Initializer for Vector4

Source§

fn zeros() -> Self

Object filled with zeros
Source§

fn ones() -> Self

Object filled with ones
Source§

impl Interpolation for Vector4

Source§

fn set_lerp(&mut self, other: &Self, s: f64) -> &mut Self

Set the linear interpolation
Source§

fn set_herp( &mut self, other: &Self, other1: &Self, other2: &Self, s: f64, ) -> &mut Self

Set the Hermite’s interpolation
Source§

fn set_berp( &mut self, other: &Self, other1: &Self, other2: &Self, s: f64, ) -> &mut Self

Set the Bezier’s interpolation
Source§

fn lerp(&self, other: &Self, s: f64) -> Self
where Self: Copy + Clone,

Get linear interpolation
Source§

fn herp(&mut self, other: &Self, other1: &Self, other2: &Self, s: f64) -> Self
where Self: Copy + Clone,

Get cubic Hermite’s interpolation, ie. with two tangent values
Source§

fn berp(&mut self, other: &Self, other1: &Self, other2: &Self, s: f64) -> Self
where Self: Copy + Clone,

Get cubic Bezier’s interpolation, ie. with two control points
Source§

impl Metric for Vector4

Source§

fn dot(&self, rhs: &Self) -> f64

Dot product of the two objects
Source§

fn magnitude2(&self) -> f64

Squared magnitude of an object
Source§

fn magnitude(&self) -> f64

Magnitude of an object
Source§

fn distance2(&self, rhs: &Self) -> f64

Squared distance between the two objects
Source§

fn distance(&self, rhs: &Self) -> f64

Distance between the two objects
Source§

fn set_normalized(&mut self) -> &mut Self

Normalizes the vector, ie. sets magnitude to 1 without changing direction
Source§

fn normalized(&self) -> Self

Get the normalized vector, ie. vector with same direction and magnitude 1
Source§

impl Mul<Vector4> for Matrix4

Source§

type Output = Vector4

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<f64> for Vector4

Source§

type Output = Vector4

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl MulAssign<Matrix4> for Vector4

Source§

fn mul_assign(&mut self, rhs: Matrix4)

Performs the *= operation. Read more
Source§

impl MulAssign<f64> for Vector4

Source§

fn mul_assign(&mut self, rhs: f64)

Performs the *= operation. Read more
Source§

impl Neg for Vector4

Source§

type Output = Vector4

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Not for Vector4

Source§

type Output = f64

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl PartialEq for Vector4

Source§

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

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

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

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

impl Rem for Vector4

Source§

type Output = f64

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

impl Reset<Vector4> for Vector4

Source§

fn reset0(&mut self) -> &mut Self

Fills an object with zeros
Source§

fn reset1(&mut self) -> &mut Self

Fills a object with ones
Source§

fn reset(&mut self, val: &Vector4) -> &mut Self

Fills a object with a given value
Source§

impl Split<Vector2> for Vector4

Source§

fn split(&self) -> [Vector2; 2]

Get the two parts of the split object
Source§

fn concat(lhs: &Vector2, rhs: &Vector2) -> Self

Concatenates two part to construct an object
Source§

fn upper(&self) -> Vector2

Get the first part of the object
Source§

fn lower(&self) -> Vector2

Get the second part of the object
Source§

fn set_upper(&mut self, vector: &Vector2) -> &mut Self

Set the first part of the object
Source§

fn set_lower(&mut self, vector: &Vector2) -> &mut Self

Set the second part of the object
Source§

impl Sub<Vector4> for Point2

Source§

type Output = Point<Vector2>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub for Vector4

Source§

type Output = Vector4

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl SubAssign<Vector4> for Point2

Source§

fn sub_assign(&mut self, rhs: Vector4)

Performs the -= operation. Read more
Source§

impl SubAssign for Vector4

Source§

fn sub_assign(&mut self, rhs: Vector4)

Performs the -= operation. Read more
Source§

impl Vector<Vector4> for Point2

Source§

fn to_vector(&self) -> Vector4

Convert the object to vector
Source§

fn set_vector(&mut self, vector: &Vector4) -> &mut Self

Set the object from vector
Source§

impl Copy for Vector4

Auto Trait Implementations§

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.