pub struct Vector2<U> {
pub x: U,
pub y: U,
}
Fields§
§x: U
§y: U
Implementations§
Source§impl<U, W> Vector2<U>
impl<U, W> Vector2<U>
pub fn length_squared(self) -> W
Source§impl Vector2<f32>
impl Vector2<f32>
pub fn from_angle(angle: f32, magnitude: f32) -> Self
pub fn length(self) -> f32
pub fn distance(self, other: Self) -> f32
pub fn normalized(self) -> Self
pub fn normalize(&mut self) -> &mut Self
pub fn angle(self) -> f32
pub fn angle_from(self, other: Self) -> f32
Source§impl Vector2<f64>
impl Vector2<f64>
pub fn from_angle(angle: f64, magnitude: f64) -> Self
pub fn length(&self) -> f64
pub fn distance(self, other: Self) -> f64
pub fn normalized(&self) -> Self
pub fn normalize(&mut self) -> &mut Self
pub fn angle(&self) -> f64
pub fn angle_between(&self, other: &Self) -> f64
Trait Implementations§
Source§impl<U: AddAssign> AddAssign for Vector2<U>
impl<U: AddAssign> AddAssign for Vector2<U>
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moreSource§impl<U: DivAssign + Clone> DivAssign<U> for Vector2<U>
impl<U: DivAssign + Clone> DivAssign<U> for Vector2<U>
Source§fn div_assign(&mut self, rhs: U)
fn div_assign(&mut self, rhs: U)
Performs the
/=
operation. Read moreSource§impl<U: Clone + Copy + MulAssign> MulAssign<U> for Vector2<U>
impl<U: Clone + Copy + MulAssign> MulAssign<U> for Vector2<U>
Source§fn mul_assign(&mut self, rhs: U)
fn mul_assign(&mut self, rhs: U)
Performs the
*=
operation. Read moreSource§impl<U: SubAssign> SubAssign for Vector2<U>
impl<U: SubAssign> SubAssign for Vector2<U>
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreimpl<U: Copy> Copy for Vector2<U>
impl<U: Eq> Eq for Vector2<U>
impl<U> StructuralPartialEq for Vector2<U>
Auto Trait Implementations§
impl<U> Freeze for Vector2<U>where
U: Freeze,
impl<U> RefUnwindSafe for Vector2<U>where
U: RefUnwindSafe,
impl<U> Send for Vector2<U>where
U: Send,
impl<U> Sync for Vector2<U>where
U: Sync,
impl<U> Unpin for Vector2<U>where
U: Unpin,
impl<U> UnwindSafe for Vector2<U>where
U: 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