pub struct Vector<T> {
pub x: T,
pub y: T,
}Expand description
The 2D vector type.
Fields§
§x: TThe component representing the x axis.
y: TThe component representing the y axis.
Implementations§
Trait Implementations§
Source§impl<T: AddAssign> AddAssign<Vector<T>> for Point<T>
impl<T: AddAssign> AddAssign<Vector<T>> for Point<T>
Source§fn add_assign(&mut self, other: Vector<T>)
fn add_assign(&mut self, other: Vector<T>)
Performs the
+= operation. Read moreSource§impl<T> AddAssign for Vector<T>where
T: AddAssign,
impl<T> AddAssign for Vector<T>where
T: AddAssign,
Source§fn add_assign(&mut self, __rhs: Self)
fn add_assign(&mut self, __rhs: Self)
Performs the
+= operation. Read moreSource§impl<T: Real> Basis<0> for Vector<T>
impl<T: Real> Basis<0> for Vector<T>
Source§fn unit_basis() -> Self
fn unit_basis() -> Self
Creates an unit basis of the vector space.
Source§fn basis_of(x: T) -> Self
fn basis_of(x: T) -> Self
Creates a scaled basis of the vector space of the specified magnitude.
Source§fn basis_mut(&mut self) -> &mut Self::Scalar
fn basis_mut(&mut self) -> &mut Self::Scalar
Queries a basis of a vector space as a mutable reference.
Source§fn with_basis(self, x: T) -> Self
fn with_basis(self, x: T) -> Self
Creates a new vector with a single basis set to a different value.
Source§impl<T: Real> Basis<1> for Vector<T>
impl<T: Real> Basis<1> for Vector<T>
Source§fn unit_basis() -> Self
fn unit_basis() -> Self
Creates an unit basis of the vector space.
Source§fn basis_of(y: T) -> Self
fn basis_of(y: T) -> Self
Creates a scaled basis of the vector space of the specified magnitude.
Source§fn basis_mut(&mut self) -> &mut Self::Scalar
fn basis_mut(&mut self) -> &mut Self::Scalar
Queries a basis of a vector space as a mutable reference.
Source§fn with_basis(self, y: T) -> Self
fn with_basis(self, y: T) -> Self
Creates a new vector with a single basis set to a different value.
Source§impl<T> DivAssign<T> for Vector<T>
impl<T> DivAssign<T> for Vector<T>
Source§fn div_assign(&mut self, other: T)
fn div_assign(&mut self, other: T)
Performs the
/= operation. Read moreSource§impl<T: Real> DotProduct for Vector<T>
impl<T: Real> DotProduct for Vector<T>
Source§impl<T> MulAssign<T> for Vector<T>
impl<T> MulAssign<T> for Vector<T>
Source§fn mul_assign(&mut self, other: T)
fn mul_assign(&mut self, other: T)
Performs the
*= operation. Read moreSource§impl<T: SubAssign> SubAssign<Vector<T>> for Point<T>
impl<T: SubAssign> SubAssign<Vector<T>> for Point<T>
Source§fn sub_assign(&mut self, other: Vector<T>)
fn sub_assign(&mut self, other: Vector<T>)
Performs the
-= operation. Read moreSource§impl<T> SubAssign for Vector<T>where
T: SubAssign,
impl<T> SubAssign for Vector<T>where
T: SubAssign,
Source§fn sub_assign(&mut self, __rhs: Self)
fn sub_assign(&mut self, __rhs: Self)
Performs the
-= operation. Read moreSource§impl<T: Real> Transform<Vector<T>> for Rotor<T>
impl<T: Real> Transform<Vector<T>> for Rotor<T>
Source§fn apply_point(&self, point: Vector<T>) -> Vector<T>
fn apply_point(&self, point: Vector<T>) -> Vector<T>
Applies this transformation to a point.
Source§impl<T: Real> VectorSpace for Vector<T>
impl<T: Real> VectorSpace for Vector<T>
impl<T: Copy> Copy for Vector<T>
impl<T: Eq> Eq for Vector<T>
impl<T> StructuralPartialEq for Vector<T>
Auto Trait Implementations§
impl<T> Freeze for Vector<T>where
T: Freeze,
impl<T> RefUnwindSafe for Vector<T>where
T: RefUnwindSafe,
impl<T> Send for Vector<T>where
T: Send,
impl<T> Sync for Vector<T>where
T: Sync,
impl<T> Unpin for Vector<T>where
T: Unpin,
impl<T> UnsafeUnpin for Vector<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Vector<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T, D> AffineSpace for Twhere
T: Sub<Output = D>,
D: VectorSpace,
impl<T, D> AffineSpace for Twhere
T: Sub<Output = D>,
D: VectorSpace,
Source§impl<T> Bases for Twhere
T: VectorSpace,
impl<T> Bases for Twhere
T: VectorSpace,
Source§fn unit_bases<const I: usize>() -> Selfwhere
Self: Basis<I>,
fn unit_bases<const I: usize>() -> Selfwhere
Self: Basis<I>,
Creates the specified unit basis of the vector space.
Source§fn bases_of<const I: usize>(magnitude: Self::Scalar) -> Selfwhere
Self: Basis<I>,
fn bases_of<const I: usize>(magnitude: Self::Scalar) -> Selfwhere
Self: Basis<I>,
Creates the specified basis of the vector of the specified magnitude.
Source§fn bases<const I: usize>(&self) -> Self::Scalarwhere
Self: Basis<I>,
fn bases<const I: usize>(&self) -> Self::Scalarwhere
Self: Basis<I>,
Queries the specified basis of a vector space.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> InnerSpace for T
impl<T> InnerSpace for T
Source§fn magnitude2(&self) -> Self::Scalar
fn magnitude2(&self) -> Self::Scalar
The squared magnitude. Read more
Source§fn with_magnitude(self, magnitude: Self::Scalar) -> Self
fn with_magnitude(self, magnitude: Self::Scalar) -> Self
Sets the magnitude of a vector.
Source§fn with_direction(self, dir: Self) -> Self
fn with_direction(self, dir: Self) -> Self
Sets the direction of a vector.
Source§fn query_axis(&self, dir: Self) -> Self::Scalar
fn query_axis(&self, dir: Self) -> Self::Scalar
The value of the vector along the specified axis.
Source§fn normalized_project(self, dir: Self) -> Self
fn normalized_project(self, dir: Self) -> Self
Projects a vector onto an already normalized direction vector.
Source§fn normalized_reject(self, dir: Self) -> Self
fn normalized_reject(self, dir: Self) -> Self
Rejects a vector from an already normalized direction vector.
Source§fn normalized_reflect(self, dir: Self) -> Self
fn normalized_reflect(self, dir: Self) -> Self
Reflects a vector from an already normalized direction vector.