pub struct ContinuousPos {
pub x: f64,
pub y: f64,
}Expand description
2D position in continuous space.
Fields§
§x: f64X coordinate.
y: f64Y coordinate.
Implementations§
Source§impl ContinuousPos
impl ContinuousPos
Sourcepub fn distance_to(&self, other: &Self) -> f64
pub fn distance_to(&self, other: &Self) -> f64
Euclidean distance to another position (ignoring periodic boundaries).
Sourcepub fn normalized(&self) -> Self
pub fn normalized(&self) -> Self
Unit vector in the same direction, or zero if the length is negligible.
Trait Implementations§
Source§impl Add for ContinuousPos
impl Add for ContinuousPos
Source§impl Clone for ContinuousPos
impl Clone for ContinuousPos
Source§fn clone(&self) -> ContinuousPos
fn clone(&self) -> ContinuousPos
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContinuousPos
impl Debug for ContinuousPos
Source§impl Mul<f64> for ContinuousPos
impl Mul<f64> for ContinuousPos
Source§impl PartialEq for ContinuousPos
impl PartialEq for ContinuousPos
Source§impl Sub for ContinuousPos
impl Sub for ContinuousPos
impl Copy for ContinuousPos
impl StructuralPartialEq for ContinuousPos
Auto Trait Implementations§
impl Freeze for ContinuousPos
impl RefUnwindSafe for ContinuousPos
impl Send for ContinuousPos
impl Sync for ContinuousPos
impl Unpin for ContinuousPos
impl UnsafeUnpin for ContinuousPos
impl UnwindSafe for ContinuousPos
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