pub struct Vector2 {
pub x: f64,
pub y: f64,
}
Expand description
A 2-dimensional vector.
Fields§
§x: f64
§y: f64
Implementations§
Source§impl Vector2
impl Vector2
Sourcepub fn squared_magnitude(&self) -> f64
pub fn squared_magnitude(&self) -> f64
Returns the squared magnitude of the vector.
Sourcepub fn dot_product(&self, rhs: &Self) -> f64
pub fn dot_product(&self, rhs: &Self) -> f64
Returns the dot product of self
and rhs
.
Sourcepub fn cross_product_magnitude(&self, rhs: &Self) -> f64
pub fn cross_product_magnitude(&self, rhs: &Self) -> f64
Returns the magnitude of the vector formed by the cross product of
self
and rhs
.
Sourcepub fn cross_product(&self, rhs: &Self) -> Vector3
pub fn cross_product(&self, rhs: &Self) -> Vector3
Returns a Vector3
with an x
and y
of
0.0
and a z
of the computed magnitude.
Trait Implementations§
impl Copy for Vector2
Auto Trait Implementations§
impl Freeze for Vector2
impl RefUnwindSafe for Vector2
impl Send for Vector2
impl Sync for Vector2
impl Unpin for Vector2
impl UnwindSafe for Vector2
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