pub struct Vector4<S> {
pub x: S,
pub y: S,
pub z: S,
pub w: S,
}
Fields§
§x: S
§y: S
§z: S
§w: S
Implementations§
Trait Implementations§
source§impl<S: Copy> Array for Vector4<S>
impl<S: Copy> Array for Vector4<S>
type Element = S
source§fn min(self) -> Swhere
S: PartialOrd,
fn min(self) -> Swhere S: PartialOrd,
The minimum element of the array.
source§fn max(self) -> Swhere
S: PartialOrd,
fn max(self) -> Swhere S: PartialOrd,
The maximum element of the array.
source§fn as_mut_ptr(&mut self) -> *mut Self::Element
fn as_mut_ptr(&mut self) -> *mut Self::Element
Get a mutable pointer to the first element of the array.
source§fn swap_elements(&mut self, i: usize, j: usize)
fn swap_elements(&mut self, i: usize, j: usize)
Swap the elements at indices
i
and j
in-place.source§impl<S> AsMut<(S, S, S, S)> for Vector4<S>
impl<S> AsMut<(S, S, S, S)> for Vector4<S>
source§fn as_mut(&mut self) -> &mut (S, S, S, S)
fn as_mut(&mut self) -> &mut (S, S, S, S)
Converts this type into a mutable reference of the (usually inferred) input type.
source§impl<S> AsRef<(S, S, S, S)> for Vector4<S>
impl<S> AsRef<(S, S, S, S)> for Vector4<S>
source§fn as_ref(&self) -> &(S, S, S, S)
fn as_ref(&self) -> &(S, S, S, S)
Converts this type into a shared reference of the (usually inferred) input type.
source§impl<S: BaseFloat> EuclideanVector for Vector4<S>
impl<S: BaseFloat> EuclideanVector for Vector4<S>
source§fn angle(self, other: Vector4<S>) -> Rad<S>
fn angle(self, other: Vector4<S>) -> Rad<S>
The angle between the vector and
other
, in radians.source§fn is_perpendicular(self, other: Self) -> bool
fn is_perpendicular(self, other: Self) -> bool
Returns
true
if the vector is perpendicular (at right angles) to the
other vector.source§fn length2(self) -> Self::Scalar
fn length2(self) -> Self::Scalar
Returns the squared length of the vector. This does not perform an
expensive square root operation like in the
length
method and can
therefore be more efficient for comparing the lengths of two vectors.source§fn normalize(self) -> Self
fn normalize(self) -> Self
Returns a vector with the same direction, but with a
length
(or
norm
) of 1
.source§fn normalize_to(self, length: Self::Scalar) -> Self
fn normalize_to(self, length: Self::Scalar) -> Self
Returns a vector with the same direction and a given
length
.source§fn lerp(self, other: Self, amount: Self::Scalar) -> Self
fn lerp(self, other: Self, amount: Self::Scalar) -> Self
Returns the result of linarly interpolating the length of the vector
towards the length of
other
by the specified amount.source§fn normalize_self(&mut self)
fn normalize_self(&mut self)
Normalises the vector to a length of
1
.source§fn normalize_self_to(&mut self, length: Self::Scalar)
fn normalize_self_to(&mut self, length: Self::Scalar)
Normalizes the vector to
length
.source§impl<'a, S> From<&'a (S, S, S, S)> for &'a Vector4<S>
impl<'a, S> From<&'a (S, S, S, S)> for &'a Vector4<S>
source§fn from(v: &'a (S, S, S, S)) -> &'a Vector4<S>
fn from(v: &'a (S, S, S, S)) -> &'a Vector4<S>
Converts to this type from the input type.
source§impl<'a, S> From<&'a mut (S, S, S, S)> for &'a mut Vector4<S>
impl<'a, S> From<&'a mut (S, S, S, S)> for &'a mut Vector4<S>
source§fn from(v: &'a mut (S, S, S, S)) -> &'a mut Vector4<S>
fn from(v: &'a mut (S, S, S, S)) -> &'a mut Vector4<S>
Converts to this type from the input type.
source§impl<S> From<(S, S, S, S)> for Vector4<S>
impl<S> From<(S, S, S, S)> for Vector4<S>
source§fn from(v: (S, S, S, S)) -> Vector4<S>
fn from(v: (S, S, S, S)) -> Vector4<S>
Converts to this type from the input type.
source§impl<S> Into<(S, S, S, S)> for Vector4<S>
impl<S> Into<(S, S, S, S)> for Vector4<S>
source§fn into(self) -> (S, S, S, S)
fn into(self) -> (S, S, S, S)
Converts this type into the (usually inferred) input type.
source§impl<S: PartialEq> PartialEq<Vector4<S>> for Vector4<S>
impl<S: PartialEq> PartialEq<Vector4<S>> for Vector4<S>
source§impl<S: BaseNum> Vector for Vector4<S>
impl<S: BaseNum> Vector for Vector4<S>
source§fn from_value(scalar: S) -> Vector4<S>
fn from_value(scalar: S) -> Vector4<S>
Construct a vector from a single value, replicating it.
source§fn sub_s(self, scalar: S) -> Vector4<S>
fn sub_s(self, scalar: S) -> Vector4<S>
Subtract a scalar from this vector, returning a new vector.
source§fn mul_s(self, scalar: S) -> Vector4<S>
fn mul_s(self, scalar: S) -> Vector4<S>
Multiply this vector by a scalar, returning a new vector.
source§fn div_s(self, scalar: S) -> Vector4<S>
fn div_s(self, scalar: S) -> Vector4<S>
Divide this vector by a scalar, returning a new vector.
source§fn rem_s(self, scalar: S) -> Vector4<S>
fn rem_s(self, scalar: S) -> Vector4<S>
Take the remainder of this vector by a scalar, returning a new vector.
source§fn add_v(self, v: Vector4<S>) -> Vector4<S>
fn add_v(self, v: Vector4<S>) -> Vector4<S>
Add this vector to another, returning a new vector.
source§fn sub_v(self, v: Vector4<S>) -> Vector4<S>
fn sub_v(self, v: Vector4<S>) -> Vector4<S>
Subtract another vector from this one, returning a new vector.
source§fn mul_v(self, v: Vector4<S>) -> Vector4<S>
fn mul_v(self, v: Vector4<S>) -> Vector4<S>
Multiply this vector by another, returning a new vector.
source§fn div_v(self, v: Vector4<S>) -> Vector4<S>
fn div_v(self, v: Vector4<S>) -> Vector4<S>
Divide this vector by another, returning a new vector.
source§fn rem_v(self, v: Vector4<S>) -> Vector4<S>
fn rem_v(self, v: Vector4<S>) -> Vector4<S>
Take the remainder of this vector by another, returning a new scalar.
source§fn add_self_s(&mut self, scalar: S)
fn add_self_s(&mut self, scalar: S)
Add a scalar to this vector in-place.
source§fn sub_self_s(&mut self, scalar: S)
fn sub_self_s(&mut self, scalar: S)
Subtract a scalar from this vector, in-place.
source§fn mul_self_s(&mut self, scalar: S)
fn mul_self_s(&mut self, scalar: S)
Multiply this vector by a scalar, in-place.
source§fn div_self_s(&mut self, scalar: S)
fn div_self_s(&mut self, scalar: S)
Divide this vector by a scalar, in-place.
source§fn rem_self_s(&mut self, scalar: S)
fn rem_self_s(&mut self, scalar: S)
Take the remainder of this vector by a scalar, in-place.
source§fn add_self_v(&mut self, v: Vector4<S>)
fn add_self_v(&mut self, v: Vector4<S>)
Add another vector to this one, in-place.
source§fn sub_self_v(&mut self, v: Vector4<S>)
fn sub_self_v(&mut self, v: Vector4<S>)
Subtract another vector from this one, in-place.
source§fn mul_self_v(&mut self, v: Vector4<S>)
fn mul_self_v(&mut self, v: Vector4<S>)
Multiply this matrix by another, in-place.
source§fn div_self_v(&mut self, v: Vector4<S>)
fn div_self_v(&mut self, v: Vector4<S>)
Divide this matrix by anothor, in-place.
source§fn rem_self_v(&mut self, v: Vector4<S>)
fn rem_self_v(&mut self, v: Vector4<S>)
Take the remainder of this vector by another, in-place.
impl<S: Copy> Copy for Vector4<S>
impl<S: Eq> Eq for Vector4<S>
impl<S> StructuralEq for Vector4<S>
impl<S> StructuralPartialEq for Vector4<S>
Auto Trait Implementations§
impl<S> RefUnwindSafe for Vector4<S>where S: RefUnwindSafe,
impl<S> Send for Vector4<S>where S: Send,
impl<S> Sync for Vector4<S>where S: Sync,
impl<S> Unpin for Vector4<S>where S: Unpin,
impl<S> UnwindSafe for Vector4<S>where S: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more