pub struct Vec2<T = f32>(pub T, pub T);Expand description
A 2-dimensional vector.
Tuple Fields§
§0: T§1: TImplementations§
Source§impl<T> Vec2<T>where
T: Float,
impl<T> Vec2<T>where
T: Float,
Sourcepub fn to_radians(&self) -> T
👎Deprecated since 0.2.2: use Angle::from().to_radians() instead
pub fn to_radians(&self) -> T
Returns the direction of the vector in radians.
Sourcepub fn to_degrees(&self) -> T
👎Deprecated since 0.2.2: use Angle::from().to_degrees() instead
pub fn to_degrees(&self) -> T
Returns the direction of the vector in degrees.
Sourcepub fn to_angle(&self) -> Angle<T>
👎Deprecated since 0.2.2: use Angle::from() instead
pub fn to_angle(&self) -> Angle<T>
Returns the direction of the vector as an angle instance.
Sourcepub fn from_radians(radians: T) -> Self
👎Deprecated since 0.2.2: use Vec2::from(Angle::from_radians()) instead
pub fn from_radians(radians: T) -> Self
Creates a unit-vector from the angle given in radians.
Sourcepub fn from_degrees(degrees: T) -> Self
👎Deprecated since 0.2.2: use Vec2::from(Angle::from_degrees()) instead
pub fn from_degrees(degrees: T) -> Self
Creates a unit-vector from the angle given in degrees.
Sourcepub fn from_angle(angle: Angle<T>) -> Self
👎Deprecated since 0.2.2: use Vec2::from() instead
pub fn from_angle(angle: Angle<T>) -> Self
Creates a unit-vector from given angle.
Trait Implementations§
Source§impl<T> AddAssign for Vec2<T>where
T: Float,
impl<T> AddAssign for Vec2<T>where
T: Float,
Source§fn add_assign(&mut self, other: Vec2<T>)
fn add_assign(&mut self, other: Vec2<T>)
Performs the
+= operation. Read moreSource§impl<T> DivAssign<T> for Vec2<T>where
T: Float,
impl<T> DivAssign<T> for Vec2<T>where
T: Float,
Source§fn div_assign(&mut self, other: T)
fn div_assign(&mut self, other: T)
Mutates the vector by dividing it by given scalar.
Source§impl<T> DivAssign for Vec2<T>where
T: Float,
impl<T> DivAssign for Vec2<T>where
T: Float,
Source§fn div_assign(&mut self, other: Vec2<T>)
fn div_assign(&mut self, other: Vec2<T>)
Mutates the vector by dividing its components with those of the given vector.
Source§impl<T> MulAssign<T> for Vec2<T>where
T: Float,
impl<T> MulAssign<T> for Vec2<T>where
T: Float,
Source§fn mul_assign(&mut self, other: T)
fn mul_assign(&mut self, other: T)
Mutates the vector by multiplying it with the scalar operand.
Source§impl<T> MulAssign for Vec2<T>where
T: Float,
impl<T> MulAssign for Vec2<T>where
T: Float,
Source§fn mul_assign(&mut self, other: Vec2<T>)
fn mul_assign(&mut self, other: Vec2<T>)
Mutates the vector by multiplying its components with those of the given vector.
Source§impl<T> SubAssign for Vec2<T>where
T: Float,
impl<T> SubAssign for Vec2<T>where
T: Float,
Source§fn sub_assign(&mut self, other: Vec2<T>)
fn sub_assign(&mut self, other: Vec2<T>)
Performs the
-= operation. Read moreimpl<T: Copy> Copy for Vec2<T>
Auto Trait Implementations§
impl<T> Freeze for Vec2<T>where
T: Freeze,
impl<T> RefUnwindSafe for Vec2<T>where
T: RefUnwindSafe,
impl<T> Send for Vec2<T>where
T: Send,
impl<T> Sync for Vec2<T>where
T: Sync,
impl<T> Unpin for Vec2<T>where
T: Unpin,
impl<T> UnwindSafe for Vec2<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