pub struct Vec2 {
pub x: f64,
pub y: f64,
}Expand description
2D vector (fluid grids, planar geometry).
Fields§
§x: f64§y: f64Implementations§
Source§impl Vec2
impl Vec2
pub const ZERO: Vec2
Sourcepub fn magnitude_squared(&self) -> f64
pub fn magnitude_squared(&self) -> f64
Squared length.
Sourcepub fn normalized(&self) -> Self
pub fn normalized(&self) -> Self
Unit vector in this direction (zero vector maps to zero).
Sourcepub fn distance_to(&self, other: &Vec2) -> f64
pub fn distance_to(&self, other: &Vec2) -> f64
Distance to another point.
Sourcepub fn angle_between(&self, other: &Vec2) -> f64
pub fn angle_between(&self, other: &Vec2) -> f64
Unsigned angle to another vector in [0, pi].
Trait Implementations§
impl 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 UnsafeUnpin 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