pub struct Vec2 { /* private fields */ }Expand description
A 2D vector with f32 components.
Vec2 provides convenient methods for 2D vector arithmetic, normalization, and conversion.
§Example
use vectorama::Vec2;
let v = Vec2::new(1.0, 2.0);Implementations§
Source§impl Vec2
impl Vec2
Sourcepub fn ones() -> Self
pub fn ones() -> Self
Returns a vector with both components set to one.
§Returns
A vector with all components equal to 1.0.
Trait Implementations§
Source§impl AddAssign<&Vec2> for Translation2
impl AddAssign<&Vec2> for Translation2
Source§fn add_assign(&mut self, rhs: &Vec2)
fn add_assign(&mut self, rhs: &Vec2)
Performs the
+= operation. Read moreSource§impl AddAssign<&Vec2> for Vec2
impl AddAssign<&Vec2> for Vec2
Source§fn add_assign(&mut self, rhs: &Vec2)
fn add_assign(&mut self, rhs: &Vec2)
Performs the
+= operation. Read moreSource§impl AddAssign<Vec2> for Translation2
impl AddAssign<Vec2> for Translation2
Source§fn add_assign(&mut self, rhs: Vec2)
fn add_assign(&mut self, rhs: Vec2)
Performs the
+= operation. Read moreSource§impl AddAssign for Vec2
impl AddAssign for Vec2
Source§fn add_assign(&mut self, rhs: Vec2)
fn add_assign(&mut self, rhs: Vec2)
Performs the
+= operation. Read moreSource§impl DivAssign<f32> for Vec2
impl DivAssign<f32> for Vec2
Source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
Performs the
/= operation. Read moreSource§impl From<Translation2> for Vec2
impl From<Translation2> for Vec2
Source§fn from(translation: Translation2) -> Self
fn from(translation: Translation2) -> Self
Converts to this type from the input type.
Source§impl From<Vec2> for Translation2
impl From<Vec2> for Translation2
Source§impl Mul<&Vec2> for &Translation2
impl Mul<&Vec2> for &Translation2
Source§impl Mul<&Vec2> for Translation2
impl Mul<&Vec2> for Translation2
Source§impl Mul<Vec2> for &Translation2
impl Mul<Vec2> for &Translation2
Source§impl Mul<Vec2> for Translation2
impl Mul<Vec2> for Translation2
Source§impl MulAssign<f32> for Vec2
impl MulAssign<f32> for Vec2
Source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
Performs the
*= operation. Read moreSource§impl SubAssign<&Vec2> for Translation2
impl SubAssign<&Vec2> for Translation2
Source§fn sub_assign(&mut self, rhs: &Vec2)
fn sub_assign(&mut self, rhs: &Vec2)
Performs the
-= operation. Read moreSource§impl SubAssign<&Vec2> for Vec2
impl SubAssign<&Vec2> for Vec2
Source§fn sub_assign(&mut self, rhs: &Vec2)
fn sub_assign(&mut self, rhs: &Vec2)
Performs the
-= operation. Read moreSource§impl SubAssign<Vec2> for Translation2
impl SubAssign<Vec2> for Translation2
Source§fn sub_assign(&mut self, rhs: Vec2)
fn sub_assign(&mut self, rhs: Vec2)
Performs the
-= operation. Read moreSource§impl SubAssign for Vec2
impl SubAssign for Vec2
Source§fn sub_assign(&mut self, rhs: Vec2)
fn sub_assign(&mut self, rhs: Vec2)
Performs the
-= operation. Read moreimpl Copy for Vec2
Auto Trait Implementations§
impl Freeze for Vec2
impl RefUnwindSafe for Vec2
impl Send for Vec2
impl Sync for Vec2
impl Unpin for Vec2
impl UnwindSafe for Vec2
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