Expand description
This represents world-space in meters.
Fields
x: f64
y: f64
Implementations
sourceimpl Pt2D
impl Pt2D
pub fn new(x: f64, y: f64) -> Pt2D
pub fn zero() -> Self
pub fn approx_eq(self, other: Pt2D, threshold: Distance) -> bool
pub fn x(self) -> f64
pub fn y(self) -> f64
sourcepub fn project_away(self, dist: Distance, theta: Angle) -> Pt2D
pub fn project_away(self, dist: Distance, theta: Angle) -> Pt2D
If distance is negative, this projects a point in theta.opposite()
pub(crate) fn raw_dist_to(self, to: Pt2D) -> f64
pub fn dist_to(self, to: Pt2D) -> Distance
sourcepub fn fast_dist(self, other: Pt2D) -> NotNan<f64>
pub fn fast_dist(self, other: Pt2D) -> NotNan<f64>
Pretty meaningless units, for comparing distances very roughly
pub fn angle_to(self, to: Pt2D) -> Angle
pub fn offset(self, dx: f64, dy: f64) -> Pt2D
pub fn center(pts: &[Pt2D]) -> Pt2D
pub fn approx_dedupe(pts: Vec<Pt2D>, threshold: Distance) -> Vec<Pt2D>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
pub fn to_hashable(self) -> HashablePt2D
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Pt2D
impl<'de> Deserialize<'de> for Pt2D
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Pt2D
Auto Trait Implementations
impl RefUnwindSafe for Pt2D
impl Send for Pt2D
impl Sync for Pt2D
impl Unpin for Pt2D
impl UnwindSafe for Pt2D
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more