#[repr(C)]pub struct Vec2 {
pub x: f32,
pub y: f32,
}Fields§
§x: f32§y: f32Implementations§
Source§impl Vec2
impl Vec2
pub const fn new(x: f32, y: f32) -> Self
Sourcepub fn sqr_magnitude(&self) -> f32
pub fn sqr_magnitude(&self) -> f32
Returns the square of the vector’s length.
Faster to compute than magnitude()
Sourcepub fn normalized(&self) -> Self
pub fn normalized(&self) -> Self
Returns a normalized copy of self
pub fn extend(&self, z: f32) -> Vec3
pub fn xx(&self) -> Vec2
Available on crate feature
swizzle only.pub fn xy(&self) -> Vec2
Available on crate feature
swizzle only.pub fn yx(&self) -> Vec2
Available on crate feature
swizzle only.pub fn yy(&self) -> Vec2
Available on crate feature
swizzle only.pub fn xxx(&self) -> Vec3
Available on crate feature
swizzle only.pub fn xxy(&self) -> Vec3
Available on crate feature
swizzle only.pub fn xyx(&self) -> Vec3
Available on crate feature
swizzle only.pub fn xyy(&self) -> Vec3
Available on crate feature
swizzle only.pub fn yxx(&self) -> Vec3
Available on crate feature
swizzle only.pub fn yxy(&self) -> Vec3
Available on crate feature
swizzle only.pub fn yyx(&self) -> Vec3
Available on crate feature
swizzle only.pub fn yyy(&self) -> Vec3
Available on crate feature
swizzle only.pub fn xxxx(&self) -> Vec4
Available on crate feature
swizzle only.pub fn xxxy(&self) -> Vec4
Available on crate feature
swizzle only.pub fn xxyx(&self) -> Vec4
Available on crate feature
swizzle only.pub fn xxyy(&self) -> Vec4
Available on crate feature
swizzle only.pub fn xyxx(&self) -> Vec4
Available on crate feature
swizzle only.pub fn xyxy(&self) -> Vec4
Available on crate feature
swizzle only.pub fn xyyx(&self) -> Vec4
Available on crate feature
swizzle only.pub fn xyyy(&self) -> Vec4
Available on crate feature
swizzle only.pub fn yxxx(&self) -> Vec4
Available on crate feature
swizzle only.pub fn yxxy(&self) -> Vec4
Available on crate feature
swizzle only.pub fn yxyx(&self) -> Vec4
Available on crate feature
swizzle only.pub fn yxyy(&self) -> Vec4
Available on crate feature
swizzle only.pub fn yyxx(&self) -> Vec4
Available on crate feature
swizzle only.pub fn yyxy(&self) -> Vec4
Available on crate feature
swizzle only.pub fn yyyx(&self) -> Vec4
Available on crate feature
swizzle only.pub fn yyyy(&self) -> Vec4
Available on crate feature
swizzle only.Trait Implementations§
Source§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 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<&Vec2> for Vec2
impl DivAssign<&Vec2> for Vec2
Source§fn div_assign(&mut self, rhs: &Vec2)
fn div_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 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 DivAssign for Vec2
impl DivAssign for Vec2
Source§fn div_assign(&mut self, rhs: Vec2)
fn div_assign(&mut self, rhs: Vec2)
Performs the
/= operation. Read moreSource§impl MulAssign<&Vec2> for Vec2
impl MulAssign<&Vec2> for Vec2
Source§fn mul_assign(&mut self, rhs: &Vec2)
fn mul_assign(&mut self, rhs: &Vec2)
Performs the
*= operation. Read moreSource§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 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 MulAssign for Vec2
impl MulAssign for Vec2
Source§fn mul_assign(&mut self, rhs: Vec2)
fn mul_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 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
impl StructuralPartialEq 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