pub struct Point2<Num = f64> { /* private fields */ }Expand description
A point in 2-dimensional cartesian coordinate space.
Implementations§
Trait Implementations§
Source§impl<Num> AbsDiffEq for Point2<Num>
impl<Num> AbsDiffEq for Point2<Num>
Source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
Source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate
equality of two numbers.
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of
AbsDiffEq::abs_diff_eq.Source§impl<Num: Num + Copy + PartialOrd + Bounded + Scalar + FromPrimitive> CartesianPoint2d for Point2<Num>
impl<Num: Num + Copy + PartialOrd + Bounded + Scalar + FromPrimitive> CartesianPoint2d for Point2<Num>
Source§fn equal(&self, other: &Self) -> boolwhere
Self: Sized,
fn equal(&self, other: &Self) -> boolwhere
Self: Sized,
Returns true, if both x and y of two points are exactly equal.
Source§fn add(&self, vec: Vector2<Self::Num>) -> Point2<Self::Num>where
Self: Sized,
fn add(&self, vec: Vector2<Self::Num>) -> Point2<Self::Num>where
Self: Sized,
Moves the point by the
vec.Source§fn sub(
&self,
other: &impl CartesianPoint2d<Num = Self::Num>,
) -> Vector2<Self::Num>
fn sub( &self, other: &impl CartesianPoint2d<Num = Self::Num>, ) -> Vector2<Self::Num>
Returns a vector between this and the
other points.Source§fn distance_sq(
&self,
other: &impl CartesianPoint2d<Num = Self::Num>,
) -> Self::Num
fn distance_sq( &self, other: &impl CartesianPoint2d<Num = Self::Num>, ) -> Self::Num
Returns squared euclidean distance between two points.
Source§fn taxicab_distance(
&self,
other: &impl CartesianPoint2d<Num = Self::Num>,
) -> Self::Num
fn taxicab_distance( &self, other: &impl CartesianPoint2d<Num = Self::Num>, ) -> Self::Num
Returns taxicab distance between two points.
Source§impl<'de, Num> Deserialize<'de> for Point2<Num>where
Num: Deserialize<'de>,
impl<'de, Num> Deserialize<'de> for Point2<Num>where
Num: Deserialize<'de>,
Source§fn 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
Source§impl<Num: Scalar> GeometryType for Point2<Num>
impl<Num: Scalar> GeometryType for Point2<Num>
Source§impl<Num: Num + Copy + PartialOrd + Bounded + Scalar + FromPrimitive> NewCartesianPoint2d<Num> for Point2<Num>
impl<Num: Num + Copy + PartialOrd + Bounded + Scalar + FromPrimitive> NewCartesianPoint2d<Num> for Point2<Num>
impl<Num: Copy> Copy for Point2<Num>
impl<Num> StructuralPartialEq for Point2<Num>
Auto Trait Implementations§
impl<Num> Freeze for Point2<Num>where
Num: Freeze,
impl<Num> RefUnwindSafe for Point2<Num>where
Num: RefUnwindSafe,
impl<Num> Send for Point2<Num>where
Num: Send,
impl<Num> Sync for Point2<Num>where
Num: Sync,
impl<Num> Unpin for Point2<Num>where
Num: Unpin,
impl<Num> UnwindSafe for Point2<Num>where
Num: UnwindSafe,
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
Source§impl<P> CartesianGeometry2dSpecialization<P, PointGeometryType> for Pwhere
P: GeometryType<Type = PointGeometryType, Space = CartesianSpace2d> + CartesianPoint2d + Copy,
impl<P> CartesianGeometry2dSpecialization<P, PointGeometryType> for Pwhere
P: GeometryType<Type = PointGeometryType, Space = CartesianSpace2d> + CartesianPoint2d + Copy,
Source§fn is_point_inside_spec<Other>(
&self,
point: &Other,
tolerance: <P as CartesianPoint2d>::Num,
) -> bool
fn is_point_inside_spec<Other>( &self, point: &Other, tolerance: <P as CartesianPoint2d>::Num, ) -> bool
Source§fn bounding_rectangle_spec(&self) -> Option<Rect<<P as CartesianPoint2d>::Num>>
fn bounding_rectangle_spec(&self) -> Option<Rect<<P as CartesianPoint2d>::Num>>
Source§impl<N, T> CartesianPoint2dFloat<N> for Twhere
N: Float,
T: CartesianPoint2d<Num = N>,
impl<N, T> CartesianPoint2dFloat<N> for Twhere
N: Float,
T: CartesianPoint2d<Num = N>,
Source§fn distance(&self, other: &impl CartesianPoint2d<Num = N>) -> N
fn distance(&self, other: &impl CartesianPoint2d<Num = N>) -> N
Euclidean distance between two points.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CoordinateMetadata for Twhere
T: ?Sized,
impl<T> CoordinateMetadata for Twhere
T: ?Sized,
Source§impl<P> GeometrySpecialization<PointGeometryType, CartesianSpace2d> for P
impl<P> GeometrySpecialization<PointGeometryType, CartesianSpace2d> for P
Source§fn project_spec<Proj>(
&self,
projection: &Proj,
) -> Option<Geom<<Proj as Projection>::OutPoint>>where
Proj: Projection<InPoint = <P as GeometrySpecialization<PointGeometryType, CartesianSpace2d>>::Point> + ?Sized,
fn project_spec<Proj>(
&self,
projection: &Proj,
) -> Option<Geom<<Proj as Projection>::OutPoint>>where
Proj: Projection<InPoint = <P as GeometrySpecialization<PointGeometryType, CartesianSpace2d>>::Point> + ?Sized,
See
Geometry::project.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.