#[repr(C)]pub struct Vector4<S> {
pub x: S,
pub y: S,
pub z: S,
pub w: S,
}
Expand description
A 4-dimensional vector.
This type is marked as #[repr(C)]
.
Fields§
§x: S
The x component of the vector.
y: S
The y component of the vector.
z: S
The z component of the vector.
w: S
The w component of the vector.
Implementations§
Trait Implementations§
source§impl<S: BaseNum + AddAssign<S>> AddAssign<Vector4<S>> for Vector4<S>
impl<S: BaseNum + AddAssign<S>> AddAssign<Vector4<S>> for Vector4<S>
source§fn add_assign(&mut self, other: Vector4<S>)
fn add_assign(&mut self, other: Vector4<S>)
Performs the
+=
operation. Read moresource§impl<S: BaseFloat> ApproxEq for Vector4<S>
impl<S: BaseFloat> ApproxEq for Vector4<S>
source§fn default_epsilon() -> S::Epsilon
fn default_epsilon() -> S::Epsilon
The default tolerance to use when testing values that are close together. Read more
source§fn default_max_relative() -> S::Epsilon
fn default_max_relative() -> S::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
source§fn default_max_ulps() -> u32
fn default_max_ulps() -> u32
The default ULPs to tolerate when testing values that are far-apart. Read more
source§fn relative_eq(
&self,
other: &Self,
epsilon: S::Epsilon,
max_relative: S::Epsilon
) -> bool
fn relative_eq( &self, other: &Self, epsilon: S::Epsilon, max_relative: S::Epsilon ) -> bool
A test for equality that uses a relative comparison if the values are far apart.
source§fn ulps_eq(&self, other: &Self, epsilon: S::Epsilon, max_ulps: u32) -> bool
fn ulps_eq(&self, other: &Self, epsilon: S::Epsilon, max_ulps: u32) -> bool
A test for equality that uses units in the last place (ULP) if the values are far apart.
source§impl<S: Copy> Array for Vector4<S>
impl<S: Copy> Array for Vector4<S>
type Element = 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. Read more
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: BaseNum + DivAssign<S>> DivAssign<S> for Vector4<S>
impl<S: BaseNum + DivAssign<S>> DivAssign<S> for Vector4<S>
source§fn div_assign(&mut self, scalar: S)
fn div_assign(&mut self, scalar: S)
Performs the
/=
operation. Read moresource§impl<S: BaseNum> ElementWise<S> for Vector4<S>
impl<S: BaseNum> ElementWise<S> for Vector4<S>
fn add_element_wise(self, rhs: S) -> Vector4<S>
fn sub_element_wise(self, rhs: S) -> Vector4<S>
fn mul_element_wise(self, rhs: S) -> Vector4<S>
fn div_element_wise(self, rhs: S) -> Vector4<S>
fn rem_element_wise(self, rhs: S) -> Vector4<S>
fn add_assign_element_wise(&mut self, rhs: S)
fn sub_assign_element_wise(&mut self, rhs: S)
fn mul_assign_element_wise(&mut self, rhs: S)
fn div_assign_element_wise(&mut self, rhs: S)
fn rem_assign_element_wise(&mut self, rhs: S)
source§impl<S: BaseNum> ElementWise<Vector4<S>> for Vector4<S>
impl<S: BaseNum> ElementWise<Vector4<S>> for Vector4<S>
fn add_element_wise(self, rhs: Vector4<S>) -> Vector4<S>
fn sub_element_wise(self, rhs: Vector4<S>) -> Vector4<S>
fn mul_element_wise(self, rhs: Vector4<S>) -> Vector4<S>
fn div_element_wise(self, rhs: Vector4<S>) -> Vector4<S>
fn rem_element_wise(self, rhs: Vector4<S>) -> Vector4<S>
fn add_assign_element_wise(&mut self, rhs: Vector4<S>)
fn sub_assign_element_wise(&mut self, rhs: Vector4<S>)
fn mul_assign_element_wise(&mut self, rhs: Vector4<S>)
fn div_assign_element_wise(&mut self, rhs: Vector4<S>)
fn rem_assign_element_wise(&mut self, rhs: Vector4<S>)
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: BaseFloat> InnerSpace for Vector4<S>
impl<S: BaseFloat> InnerSpace for Vector4<S>
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 magnitude2(self) -> Self::Scalar
fn magnitude2(self) -> Self::Scalar
Returns the squared magnitude. Read more
source§fn angle(self, other: Self) -> Rad<Self::Scalar>
fn angle(self, other: Self) -> Rad<Self::Scalar>
Returns the angle between two vectors in radians.
source§fn normalize(self) -> Self
fn normalize(self) -> Self
Returns a vector with the same direction, but with a magnitude of
1
.source§fn normalize_to(self, magnitude: Self::Scalar) -> Self
fn normalize_to(self, magnitude: Self::Scalar) -> Self
Returns a vector with the same direction and a given magnitude.
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: BaseFloat> MetricSpace for Vector4<S>
impl<S: BaseFloat> MetricSpace for Vector4<S>
source§impl<S: BaseNum + MulAssign<S>> MulAssign<S> for Vector4<S>
impl<S: BaseNum + MulAssign<S>> MulAssign<S> for Vector4<S>
source§fn mul_assign(&mut self, scalar: S)
fn mul_assign(&mut self, scalar: S)
Performs the
*=
operation. Read moresource§impl<S: PartialEq> PartialEq<Vector4<S>> for Vector4<S>
impl<S: PartialEq> PartialEq<Vector4<S>> for Vector4<S>
source§impl<S: BaseNum + RemAssign<S>> RemAssign<S> for Vector4<S>
impl<S: BaseNum + RemAssign<S>> RemAssign<S> for Vector4<S>
source§fn rem_assign(&mut self, scalar: S)
fn rem_assign(&mut self, scalar: S)
Performs the
%=
operation. Read moresource§impl<S: BaseNum + SubAssign<S>> SubAssign<Vector4<S>> for Vector4<S>
impl<S: BaseNum + SubAssign<S>> SubAssign<Vector4<S>> for Vector4<S>
source§fn sub_assign(&mut self, other: Vector4<S>)
fn sub_assign(&mut self, other: Vector4<S>)
Performs the
-=
operation. Read moreimpl<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