pub struct Vector2<T: Num + Copy> {
pub x: T,
pub y: T,
}Fields§
§x: T§y: TImplementations§
Source§impl Vector2<i32>
impl Vector2<i32>
pub const ZERO: Vector2<i32>
pub const UP: Vector2<i32>
pub const DOWN: Vector2<i32>
pub const LEFT: Vector2<i32>
pub const RIGHT: Vector2<i32>
pub fn manhattan(&self, other: Vector2<i32>) -> i32
pub fn as_f32(&self) -> Vector2<f32>
pub fn len(&self) -> f32
pub fn len_sq(&self) -> f32
pub fn angle(&self, other: &Self) -> f32
pub fn signed_angle(&self, other: &Self) -> f32
pub fn clamped(&self) -> Self
Source§impl Vector2<f32>
impl Vector2<f32>
pub const UP: Vector2<f32>
pub const DOWN: Vector2<f32>
pub const LEFT: Vector2<f32>
pub const RIGHT: Vector2<f32>
pub const ZERO: Vector2<f32>
pub fn len(&self) -> f32
pub fn len_sq(&self) -> f32
pub fn angle(&self, other: &Self) -> f32
pub fn signed_angle(&self, other: &Self) -> f32
pub fn lerp(&self, other: &Self, t: f32) -> Self
pub fn normalized(&self) -> Self
pub fn round(&self) -> Self
Trait Implementations§
Source§impl<T: Num + Copy> AddAssign for Vector2<T>
impl<T: Num + Copy> AddAssign for Vector2<T>
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+= operation. Read moreimpl<T: Copy + Num + Copy> Copy for Vector2<T>
impl<T: Eq + Num + Copy> Eq for Vector2<T>
Source§impl<T: Ord + Num + Copy> Ord for Vector2<T>
impl<T: Ord + Num + Copy> Ord for Vector2<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialEq + Num + Copy> PartialEq for Vector2<T>
impl<T: PartialEq + Num + Copy> PartialEq for Vector2<T>
Source§impl<T: PartialOrd + Num + Copy> PartialOrd for Vector2<T>
impl<T: PartialOrd + Num + Copy> PartialOrd for Vector2<T>
impl<T: Num + Copy> StructuralPartialEq for Vector2<T>
Auto Trait Implementations§
impl<T> Freeze for Vector2<T>where
T: Freeze,
impl<T> RefUnwindSafe for Vector2<T>where
T: RefUnwindSafe,
impl<T> Send for Vector2<T>where
T: Send,
impl<T> Sync for Vector2<T>where
T: Sync,
impl<T> Unpin for Vector2<T>where
T: Unpin,
impl<T> UnsafeUnpin for Vector2<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Vector2<T>where
T: 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