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
use Angle::from().to_radians() instead
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
use Angle::from().to_degrees() instead
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>
use Angle::from() instead
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
use Vec2::from(Angle::from_radians()) instead
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
use Vec2::from(Angle::from_degrees()) instead
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
use Vec2::from() instead
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>)
+= operation. Read moreimpl<T: Copy> Copy for Vec2<T>
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> 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> 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> 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.