pub struct Point<T = f64>(pub Coord<T>)
where
T: CoordNum;
Expand description
A single point in 2D space.
Points can be created using the Point::new
constructor,
the point!
macro, or from a Coord
, two-element
tuples, or arrays – see the From
impl section for a
complete list.
§Semantics
The interior of the point is itself (a singleton set),
and its boundary is empty. A point is valid if and
only if the Coord
is valid.
§Examples
use geo_types::{coord, Point};
let p1: Point = (0., 1.).into();
let c = coord! { x: 10., y: 20. };
let p2: Point = c.into();
Tuple Fields§
§0: Coord<T>
Implementations§
source§impl<T> Point<T>where
T: CoordNum,
impl<T> Point<T>where
T: CoordNum,
sourcepub fn new(x: T, y: T) -> Point<T>
pub fn new(x: T, y: T) -> Point<T>
Creates a new point.
§Examples
use geo_types::Point;
let p = Point::new(1.234, 2.345);
assert_eq!(p.x(), 1.234);
assert_eq!(p.y(), 2.345);
sourcepub fn x(self) -> T
pub fn x(self) -> T
Returns the x/horizontal component of the point.
§Examples
use geo_types::Point;
let p = Point::new(1.234, 2.345);
assert_eq!(p.x(), 1.234);
sourcepub fn set_x(&mut self, x: T) -> &mut Point<T>
pub fn set_x(&mut self, x: T) -> &mut Point<T>
Sets the x/horizontal component of the point.
§Examples
use geo_types::Point;
let mut p = Point::new(1.234, 2.345);
p.set_x(9.876);
assert_eq!(p.x(), 9.876);
sourcepub fn x_mut(&mut self) -> &mut T
pub fn x_mut(&mut self) -> &mut T
Returns a mutable reference to the x/horizontal component of the point
§Examples
use approx::assert_relative_eq;
use geo_types::Point;
let mut p = Point::new(1.234, 2.345);
let mut p_x = p.x_mut();
*p_x += 1.0;
assert_relative_eq!(p.x(), 2.234);
sourcepub fn y(self) -> T
pub fn y(self) -> T
Returns the y/vertical component of the point.
§Examples
use geo_types::Point;
let p = Point::new(1.234, 2.345);
assert_eq!(p.y(), 2.345);
sourcepub fn set_y(&mut self, y: T) -> &mut Point<T>
pub fn set_y(&mut self, y: T) -> &mut Point<T>
Sets the y/vertical component of the point.
§Examples
use geo_types::Point;
let mut p = Point::new(1.234, 2.345);
p.set_y(9.876);
assert_eq!(p.y(), 9.876);
sourcepub fn y_mut(&mut self) -> &mut T
pub fn y_mut(&mut self) -> &mut T
Returns a mutable reference to the x/horizontal component of the point
§Examples
use approx::assert_relative_eq;
use geo_types::Point;
let mut p = Point::new(1.234, 2.345);
let mut p_y = p.y_mut();
*p_y += 1.0;
assert_relative_eq!(p.y(), 3.345);
sourcepub fn x_y(self) -> (T, T)
pub fn x_y(self) -> (T, T)
Returns a tuple that contains the x/horizontal & y/vertical component of the point.
§Examples
use geo_types::Point;
let mut p = Point::new(1.234, 2.345);
let (x, y) = p.x_y();
assert_eq!(y, 2.345);
assert_eq!(x, 1.234);
sourcepub fn lng(self) -> T
👎Deprecated: use Point::x
instead, it’s less ambiguous
pub fn lng(self) -> T
Point::x
instead, it’s less ambiguousReturns the longitude/horizontal component of the point.
§Examples
use geo_types::Point;
let p = Point::new(1.234, 2.345);
assert_eq!(p.x(), 1.234);
sourcepub fn set_lng(&mut self, lng: T) -> &mut Point<T>
👎Deprecated: use Point::set_x
instead, it’s less ambiguous
pub fn set_lng(&mut self, lng: T) -> &mut Point<T>
Point::set_x
instead, it’s less ambiguousSets the longitude/horizontal component of the point.
§Examples
use geo_types::Point;
let mut p = Point::new(1.234, 2.345);
#[allow(deprecated)]
p.set_lng(9.876);
assert_eq!(p.x(), 9.876);
source§impl<T> Point<T>where
T: CoordNum,
impl<T> Point<T>where
T: CoordNum,
sourcepub fn dot(self, other: Point<T>) -> T
pub fn dot(self, other: Point<T>) -> T
Returns the dot product of the two points:
dot = x1 * x2 + y1 * y2
§Examples
use geo_types::{point, Point};
let point = point! { x: 1.5, y: 0.5 };
let dot = point.dot(point! { x: 2.0, y: 4.5 });
assert_eq!(dot, 5.25);
sourcepub fn cross_prod(self, point_b: Point<T>, point_c: Point<T>) -> T
pub fn cross_prod(self, point_b: Point<T>, point_c: Point<T>) -> T
Returns the cross product of 3 points. A positive value implies
self
→ point_b
→ point_c
is counter-clockwise, negative implies
clockwise.
§Note on Robustness
This function is not robust against floating-point errors.
The geo
crate
offers robust predicates for standard numeric types using the
Kernel
trait, and these should be preferred if possible.
§Examples
use geo_types::point;
let point_a = point! { x: 1., y: 2. };
let point_b = point! { x: 3., y: 5. };
let point_c = point! { x: 7., y: 12. };
let cross = point_a.cross_prod(point_b, point_c);
assert_eq!(cross, 2.0)
source§impl<T> Point<T>where
T: CoordFloat,
impl<T> Point<T>where
T: CoordFloat,
sourcepub fn to_degrees(self) -> Point<T>
pub fn to_degrees(self) -> Point<T>
Converts the (x,y) components of Point to degrees
§Example
use geo_types::Point;
let p = Point::new(1.234, 2.345);
let (x, y): (f32, f32) = p.to_degrees().x_y();
assert_eq!(x.round(), 71.0);
assert_eq!(y.round(), 134.0);
sourcepub fn to_radians(self) -> Point<T>
pub fn to_radians(self) -> Point<T>
Converts the (x,y) components of Point to radians
§Example
use geo_types::Point;
let p = Point::new(180.0, 341.5);
let (x, y): (f32, f32) = p.to_radians().x_y();
assert_eq!(x.round(), 3.0);
assert_eq!(y.round(), 6.0);
Trait Implementations§
source§impl<T> AbsDiffEq for Point<T>
impl<T> AbsDiffEq for Point<T>
source§fn abs_diff_eq(
&self,
other: &Point<T>,
epsilon: <Point<T> as AbsDiffEq>::Epsilon
) -> bool
fn abs_diff_eq( &self, other: &Point<T>, epsilon: <Point<T> as AbsDiffEq>::Epsilon ) -> bool
Equality assertion with an absolute limit.
§Examples
use geo_types::Point;
let a = Point::new(2.0, 3.0);
let b = Point::new(2.0, 3.0000001);
approx::assert_relative_eq!(a, b, epsilon=0.1)
source§fn default_epsilon() -> <Point<T> as AbsDiffEq>::Epsilon
fn default_epsilon() -> <Point<T> as AbsDiffEq>::Epsilon
§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
AbsDiffEq::abs_diff_eq
].source§impl<T> Add for Point<T>where
T: CoordNum,
impl<T> Add for Point<T>where
T: CoordNum,
source§impl<T> AddAssign for Point<T>where
T: CoordNum,
impl<T> AddAssign for Point<T>where
T: CoordNum,
source§fn add_assign(&mut self, rhs: Point<T>)
fn add_assign(&mut self, rhs: Point<T>)
Add a point to the given point and assign it to the original point.
§Examples
use geo_types::Point;
let mut p = Point::new(1.25, 2.5);
p += Point::new(1.5, 2.5);
assert_eq!(p.x(), 2.75);
assert_eq!(p.y(), 5.0);
source§impl<T> Area<T> for Point<T>where
T: CoordNum,
impl<T> Area<T> for Point<T>where
T: CoordNum,
fn signed_area(&self) -> T
fn unsigned_area(&self) -> T
source§impl<T> BoundingRect<T> for Point<T>where
T: CoordNum,
impl<T> BoundingRect<T> for Point<T>where
T: CoordNum,
source§impl<T> ChamberlainDuquetteArea<T> for Point<T>where
T: CoordFloat,
impl<T> ChamberlainDuquetteArea<T> for Point<T>where
T: CoordFloat,
fn chamberlain_duquette_signed_area(&self) -> T
fn chamberlain_duquette_unsigned_area(&self) -> T
source§impl<F: GeoFloat> ClosestPoint<F> for Point<F>
impl<F: GeoFloat> ClosestPoint<F> for Point<F>
source§fn closest_point(&self, p: &Self) -> Closest<F>
fn closest_point(&self, p: &Self) -> Closest<F>
self
and p
.source§impl<T> Contains<GeometryCollection<T>> for Point<T>where
T: GeoFloat,
impl<T> Contains<GeometryCollection<T>> for Point<T>where
T: GeoFloat,
fn contains(&self, geometry_collection: &GeometryCollection<T>) -> bool
source§impl<T> Contains<LineString<T>> for Point<T>where
T: CoordNum,
impl<T> Contains<LineString<T>> for Point<T>where
T: CoordNum,
fn contains(&self, line_string: &LineString<T>) -> bool
source§impl<T> Contains<MultiLineString<T>> for Point<T>where
T: CoordNum,
impl<T> Contains<MultiLineString<T>> for Point<T>where
T: CoordNum,
fn contains(&self, multi_line_string: &MultiLineString<T>) -> bool
source§impl<T> Contains<MultiPoint<T>> for Point<T>where
T: CoordNum,
impl<T> Contains<MultiPoint<T>> for Point<T>where
T: CoordNum,
fn contains(&self, multi_point: &MultiPoint<T>) -> bool
source§impl<T> Contains<MultiPolygon<T>> for Point<T>where
T: CoordNum,
impl<T> Contains<MultiPolygon<T>> for Point<T>where
T: CoordNum,
fn contains(&self, multi_polygon: &MultiPolygon<T>) -> bool
source§impl<T> Contains<Point<T>> for MultiLineString<T>
impl<T> Contains<Point<T>> for MultiLineString<T>
source§impl<T> CoordinatePosition for Point<T>where
T: GeoNum,
impl<T> CoordinatePosition for Point<T>where
T: GeoNum,
source§impl<T: CoordNum> CoordsIter for Point<T>
impl<T: CoordNum> CoordsIter for Point<T>
source§fn coords_count(&self) -> usize
fn coords_count(&self) -> usize
Return the number of coordinates in the Point
.
type Iter<'a> = Once<Coord<T>> where T: 'a
type ExteriorIter<'a> = <Point<T> as CoordsIter>::Iter<'a> where T: 'a
type Scalar = T
source§fn coords_iter(&self) -> Self::Iter<'_>
fn coords_iter(&self) -> Self::Iter<'_>
source§fn exterior_coords_iter(&self) -> Self::ExteriorIter<'_>
fn exterior_coords_iter(&self) -> Self::ExteriorIter<'_>
source§impl<T> CrossTrackDistance<T> for Point<T>where
T: CoordFloat + FromPrimitive,
impl<T> CrossTrackDistance<T> for Point<T>where
T: CoordFloat + FromPrimitive,
source§impl<T> DivAssign<T> for Point<T>where
T: CoordNum,
impl<T> DivAssign<T> for Point<T>where
T: CoordNum,
source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Scaler division of a point in place
§Examples
use geo_types::Point;
let mut p = Point::new(2.0, 3.0);
p /= 2.0;
assert_eq!(p.x(), 1.0);
assert_eq!(p.y(), 1.5);
source§impl<T> EuclideanDistance<T> for Point<T>where
T: GeoFloat,
impl<T> EuclideanDistance<T> for Point<T>where
T: GeoFloat,
source§fn euclidean_distance(&self, p: &Point<T>) -> T
fn euclidean_distance(&self, p: &Point<T>) -> T
Minimum distance between two Points
source§impl<T> EuclideanDistance<T, Geometry<T>> for Point<T>
impl<T> EuclideanDistance<T, Geometry<T>> for Point<T>
source§fn euclidean_distance(&self, geom: &Geometry<T>) -> T
fn euclidean_distance(&self, geom: &Geometry<T>) -> T
source§impl<T> EuclideanDistance<T, GeometryCollection<T>> for Point<T>
impl<T> EuclideanDistance<T, GeometryCollection<T>> for Point<T>
source§fn euclidean_distance(&self, target: &GeometryCollection<T>) -> T
fn euclidean_distance(&self, target: &GeometryCollection<T>) -> T
source§impl<T> EuclideanDistance<T, Line<T>> for Point<T>where
T: GeoFloat,
impl<T> EuclideanDistance<T, Line<T>> for Point<T>where
T: GeoFloat,
source§fn euclidean_distance(&self, line: &Line<T>) -> T
fn euclidean_distance(&self, line: &Line<T>) -> T
Minimum distance from a Line to a Point
source§impl<T> EuclideanDistance<T, LineString<T>> for Point<T>where
T: GeoFloat,
impl<T> EuclideanDistance<T, LineString<T>> for Point<T>where
T: GeoFloat,
source§fn euclidean_distance(&self, linestring: &LineString<T>) -> T
fn euclidean_distance(&self, linestring: &LineString<T>) -> T
Minimum distance from a Point to a LineString
source§impl<T> EuclideanDistance<T, MultiLineString<T>> for Point<T>
impl<T> EuclideanDistance<T, MultiLineString<T>> for Point<T>
source§fn euclidean_distance(&self, target: &MultiLineString<T>) -> T
fn euclidean_distance(&self, target: &MultiLineString<T>) -> T
source§impl<T> EuclideanDistance<T, MultiPoint<T>> for Point<T>
impl<T> EuclideanDistance<T, MultiPoint<T>> for Point<T>
source§fn euclidean_distance(&self, target: &MultiPoint<T>) -> T
fn euclidean_distance(&self, target: &MultiPoint<T>) -> T
source§impl<T> EuclideanDistance<T, MultiPolygon<T>> for Point<T>
impl<T> EuclideanDistance<T, MultiPolygon<T>> for Point<T>
source§fn euclidean_distance(&self, target: &MultiPolygon<T>) -> T
fn euclidean_distance(&self, target: &MultiPolygon<T>) -> T
source§impl<T> EuclideanDistance<T, Point<T>> for Geometry<T>
impl<T> EuclideanDistance<T, Point<T>> for Geometry<T>
source§fn euclidean_distance(&self, other: &Point<T>) -> T
fn euclidean_distance(&self, other: &Point<T>) -> T
source§impl<T> EuclideanDistance<T, Point<T>> for GeometryCollection<T>
impl<T> EuclideanDistance<T, Point<T>> for GeometryCollection<T>
source§fn euclidean_distance(&self, target: &Point<T>) -> T
fn euclidean_distance(&self, target: &Point<T>) -> T
source§impl<T> EuclideanDistance<T, Point<T>> for Line<T>where
T: GeoFloat,
impl<T> EuclideanDistance<T, Point<T>> for Line<T>where
T: GeoFloat,
source§fn euclidean_distance(&self, point: &Point<T>) -> T
fn euclidean_distance(&self, point: &Point<T>) -> T
Minimum distance from a Line to a Point
source§impl<T> EuclideanDistance<T, Point<T>> for LineString<T>where
T: GeoFloat,
impl<T> EuclideanDistance<T, Point<T>> for LineString<T>where
T: GeoFloat,
source§fn euclidean_distance(&self, point: &Point<T>) -> T
fn euclidean_distance(&self, point: &Point<T>) -> T
Minimum distance from a LineString to a Point
source§impl<T> EuclideanDistance<T, Point<T>> for MultiLineString<T>
impl<T> EuclideanDistance<T, Point<T>> for MultiLineString<T>
source§fn euclidean_distance(&self, target: &Point<T>) -> T
fn euclidean_distance(&self, target: &Point<T>) -> T
source§impl<T> EuclideanDistance<T, Point<T>> for MultiPoint<T>
impl<T> EuclideanDistance<T, Point<T>> for MultiPoint<T>
source§fn euclidean_distance(&self, target: &Point<T>) -> T
fn euclidean_distance(&self, target: &Point<T>) -> T
source§impl<T> EuclideanDistance<T, Point<T>> for MultiPolygon<T>
impl<T> EuclideanDistance<T, Point<T>> for MultiPolygon<T>
source§fn euclidean_distance(&self, target: &Point<T>) -> T
fn euclidean_distance(&self, target: &Point<T>) -> T
source§impl<T> EuclideanDistance<T, Point<T>> for Polygon<T>where
T: GeoFloat,
impl<T> EuclideanDistance<T, Point<T>> for Polygon<T>where
T: GeoFloat,
source§fn euclidean_distance(&self, point: &Point<T>) -> T
fn euclidean_distance(&self, point: &Point<T>) -> T
Minimum distance from a Polygon to a Point
source§impl<T> EuclideanDistance<T, Point<T>> for Rect<T>
impl<T> EuclideanDistance<T, Point<T>> for Rect<T>
source§fn euclidean_distance(&self, other: &Point<T>) -> T
fn euclidean_distance(&self, other: &Point<T>) -> T
source§impl<T> EuclideanDistance<T, Point<T>> for Triangle<T>
impl<T> EuclideanDistance<T, Point<T>> for Triangle<T>
source§fn euclidean_distance(&self, other: &Point<T>) -> T
fn euclidean_distance(&self, other: &Point<T>) -> T
source§impl<T> EuclideanDistance<T, Polygon<T>> for Point<T>where
T: GeoFloat,
impl<T> EuclideanDistance<T, Polygon<T>> for Point<T>where
T: GeoFloat,
source§fn euclidean_distance(&self, polygon: &Polygon<T>) -> T
fn euclidean_distance(&self, polygon: &Polygon<T>) -> T
Minimum distance from a Point to a Polygon
source§impl<T> EuclideanDistance<T, Rect<T>> for Point<T>
impl<T> EuclideanDistance<T, Rect<T>> for Point<T>
source§fn euclidean_distance(&self, other: &Rect<T>) -> T
fn euclidean_distance(&self, other: &Rect<T>) -> T
source§impl<T> EuclideanDistance<T, Triangle<T>> for Point<T>
impl<T> EuclideanDistance<T, Triangle<T>> for Point<T>
source§fn euclidean_distance(&self, other: &Triangle<T>) -> T
fn euclidean_distance(&self, other: &Triangle<T>) -> T
source§impl GeodesicArea<f64> for Point
impl GeodesicArea<f64> for Point
source§fn geodesic_perimeter(&self) -> f64
fn geodesic_perimeter(&self) -> f64
source§fn geodesic_area_signed(&self) -> f64
fn geodesic_area_signed(&self) -> f64
source§fn geodesic_area_unsigned(&self) -> f64
fn geodesic_area_unsigned(&self) -> f64
source§impl GeodesicBearing<f64> for Point<f64>
impl GeodesicBearing<f64> for Point<f64>
source§impl GeodesicDistance<f64> for Point
impl GeodesicDistance<f64> for Point
source§impl GeodesicIntermediate<f64> for Point
impl GeodesicIntermediate<f64> for Point
source§impl<C: CoordNum> HasDimensions for Point<C>
impl<C: CoordNum> HasDimensions for Point<C>
source§fn dimensions(&self) -> Dimensions
fn dimensions(&self) -> Dimensions
Rect
s are 2-dimensional, but it’s possible to create degenerate Rect
s which
have either 1 or 0 dimensions. Read moresource§fn boundary_dimensions(&self) -> Dimensions
fn boundary_dimensions(&self) -> Dimensions
Geometry
’s boundary, as used by OGC-SFA. Read moresource§impl<T> HaversineBearing<T> for Point<T>where
T: CoordFloat,
impl<T> HaversineBearing<T> for Point<T>where
T: CoordFloat,
source§fn haversine_bearing(&self, point: Point<T>) -> T
fn haversine_bearing(&self, point: Point<T>) -> T
source§impl<T> HaversineClosestPoint<T> for Point<T>where
T: GeoFloat + FromPrimitive,
impl<T> HaversineClosestPoint<T> for Point<T>where
T: GeoFloat + FromPrimitive,
fn haversine_closest_point(&self, pt: &Point<T>) -> Closest<T>
source§impl<T> HaversineDestination<T> for Point<T>where
T: CoordFloat + FromPrimitive,
impl<T> HaversineDestination<T> for Point<T>where
T: CoordFloat + FromPrimitive,
source§fn haversine_destination(&self, bearing: T, distance: T) -> Point<T>
fn haversine_destination(&self, bearing: T, distance: T) -> Point<T>
source§impl<T> HaversineDistance<T> for Point<T>where
T: CoordFloat + FromPrimitive,
impl<T> HaversineDistance<T> for Point<T>where
T: CoordFloat + FromPrimitive,
source§fn haversine_distance(&self, rhs: &Point<T>) -> T
fn haversine_distance(&self, rhs: &Point<T>) -> T
source§impl<T> HaversineIntermediate<T> for Point<T>where
T: CoordFloat + FromPrimitive,
impl<T> HaversineIntermediate<T> for Point<T>where
T: CoordFloat + FromPrimitive,
source§impl<T> InteriorPoint for Point<T>where
T: GeoFloat,
impl<T> InteriorPoint for Point<T>where
T: GeoFloat,
source§impl<T, G> Intersects<G> for Point<T>
impl<T, G> Intersects<G> for Point<T>
fn intersects(&self, rhs: &G) -> bool
source§impl<T> Intersects<MultiLineString<T>> for Point<T>
impl<T> Intersects<MultiLineString<T>> for Point<T>
fn intersects(&self, rhs: &MultiLineString<T>) -> bool
source§impl<T> Intersects<MultiPolygon<T>> for Point<T>
impl<T> Intersects<MultiPolygon<T>> for Point<T>
fn intersects(&self, rhs: &MultiPolygon<T>) -> bool
source§impl<T> Intersects<Point<T>> for Coord<T>where
T: CoordNum,
impl<T> Intersects<Point<T>> for Coord<T>where
T: CoordNum,
fn intersects(&self, rhs: &Point<T>) -> bool
source§impl<T> Intersects<Point<T>> for Line<T>
impl<T> Intersects<Point<T>> for Line<T>
fn intersects(&self, rhs: &Point<T>) -> bool
source§impl<T> Intersects<Point<T>> for Polygon<T>
impl<T> Intersects<Point<T>> for Polygon<T>
fn intersects(&self, rhs: &Point<T>) -> bool
source§impl<T> Intersects<Point<T>> for Rect<T>
impl<T> Intersects<Point<T>> for Rect<T>
fn intersects(&self, rhs: &Point<T>) -> bool
source§impl<T> Intersects<Point<T>> for Triangle<T>
impl<T> Intersects<Point<T>> for Triangle<T>
fn intersects(&self, rhs: &Point<T>) -> bool
source§impl<T> LineLocatePoint<T, Point<T>> for Line<T>where
T: CoordFloat,
impl<T> LineLocatePoint<T, Point<T>> for Line<T>where
T: CoordFloat,
source§impl<T> LineLocatePoint<T, Point<T>> for LineString<T>where
T: CoordFloat + AddAssign,
Line<T>: EuclideanDistance<T, Point<T>> + EuclideanLength<T>,
LineString<T>: EuclideanLength<T>,
impl<T> LineLocatePoint<T, Point<T>> for LineString<T>where
T: CoordFloat + AddAssign,
Line<T>: EuclideanDistance<T, Point<T>> + EuclideanLength<T>,
LineString<T>: EuclideanLength<T>,
source§impl<T: CoordNum, NT: CoordNum> MapCoords<T, NT> for Point<T>
impl<T: CoordNum, NT: CoordNum> MapCoords<T, NT> for Point<T>
source§impl<T: CoordNum> MapCoordsInPlace<T> for Point<T>
impl<T: CoordNum> MapCoordsInPlace<T> for Point<T>
source§impl<T> MulAssign<T> for Point<T>where
T: CoordNum,
impl<T> MulAssign<T> for Point<T>where
T: CoordNum,
source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Scaler multiplication of a point in place
§Examples
use geo_types::Point;
let mut p = Point::new(2.0, 3.0);
p *= 2.0;
assert_eq!(p.x(), 4.0);
assert_eq!(p.y(), 6.0);
source§impl<T> PartialEq for Point<T>
impl<T> PartialEq for Point<T>
source§impl<T> Point for Point<T>
impl<T> Point for Point<T>
source§const DIMENSIONS: usize = 2usize
const DIMENSIONS: usize = 2usize
source§fn generate(
generator: impl FnMut(usize) -> <Point<T> as Point>::Scalar
) -> Point<T>
fn generate( generator: impl FnMut(usize) -> <Point<T> as Point>::Scalar ) -> Point<T>
source§impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for Point<F>
impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for Point<F>
fn relate(&self, other: &GeometryCollection<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, Line<F>> for Point<F>
impl<F: GeoFloat> Relate<F, Line<F>> for Point<F>
fn relate(&self, other: &Line<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, LineString<F>> for Point<F>
impl<F: GeoFloat> Relate<F, LineString<F>> for Point<F>
fn relate(&self, other: &LineString<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, MultiLineString<F>> for Point<F>
impl<F: GeoFloat> Relate<F, MultiLineString<F>> for Point<F>
fn relate(&self, other: &MultiLineString<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, MultiPoint<F>> for Point<F>
impl<F: GeoFloat> Relate<F, MultiPoint<F>> for Point<F>
fn relate(&self, other: &MultiPoint<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, MultiPolygon<F>> for Point<F>
impl<F: GeoFloat> Relate<F, MultiPolygon<F>> for Point<F>
fn relate(&self, other: &MultiPolygon<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, Point<F>> for GeometryCollection<F>
impl<F: GeoFloat> Relate<F, Point<F>> for GeometryCollection<F>
fn relate(&self, other: &Point<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, Point<F>> for Line<F>
impl<F: GeoFloat> Relate<F, Point<F>> for Line<F>
fn relate(&self, other: &Point<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, Point<F>> for LineString<F>
impl<F: GeoFloat> Relate<F, Point<F>> for LineString<F>
fn relate(&self, other: &Point<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, Point<F>> for MultiLineString<F>
impl<F: GeoFloat> Relate<F, Point<F>> for MultiLineString<F>
fn relate(&self, other: &Point<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, Point<F>> for MultiPoint<F>
impl<F: GeoFloat> Relate<F, Point<F>> for MultiPoint<F>
fn relate(&self, other: &Point<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, Point<F>> for MultiPolygon<F>
impl<F: GeoFloat> Relate<F, Point<F>> for MultiPolygon<F>
fn relate(&self, other: &Point<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, Point<F>> for Point<F>
impl<F: GeoFloat> Relate<F, Point<F>> for Point<F>
fn relate(&self, other: &Point<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, Point<F>> for Polygon<F>
impl<F: GeoFloat> Relate<F, Point<F>> for Polygon<F>
fn relate(&self, other: &Point<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, Point<F>> for Rect<F>
impl<F: GeoFloat> Relate<F, Point<F>> for Rect<F>
fn relate(&self, other: &Point<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, Point<F>> for Triangle<F>
impl<F: GeoFloat> Relate<F, Point<F>> for Triangle<F>
fn relate(&self, other: &Point<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, Polygon<F>> for Point<F>
impl<F: GeoFloat> Relate<F, Polygon<F>> for Point<F>
fn relate(&self, other: &Polygon<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, Rect<F>> for Point<F>
impl<F: GeoFloat> Relate<F, Rect<F>> for Point<F>
fn relate(&self, other: &Rect<F>) -> IntersectionMatrix
source§impl<F: GeoFloat> Relate<F, Triangle<F>> for Point<F>
impl<F: GeoFloat> Relate<F, Triangle<F>> for Point<F>
fn relate(&self, other: &Triangle<F>) -> IntersectionMatrix
source§impl<T> RelativeEq for Point<T>where
T: AbsDiffEq<Epsilon = T> + CoordNum + RelativeEq,
impl<T> RelativeEq for Point<T>where
T: AbsDiffEq<Epsilon = T> + CoordNum + RelativeEq,
source§fn relative_eq(
&self,
other: &Point<T>,
epsilon: <Point<T> as AbsDiffEq>::Epsilon,
max_relative: <Point<T> as AbsDiffEq>::Epsilon
) -> bool
fn relative_eq( &self, other: &Point<T>, epsilon: <Point<T> as AbsDiffEq>::Epsilon, max_relative: <Point<T> as AbsDiffEq>::Epsilon ) -> bool
Equality assertion within a relative limit.
§Examples
use geo_types::Point;
let a = Point::new(2.0, 3.0);
let b = Point::new(2.0, 3.01);
approx::assert_relative_eq!(a, b, max_relative=0.1)
source§fn default_max_relative() -> <Point<T> as AbsDiffEq>::Epsilon
fn default_max_relative() -> <Point<T> as AbsDiffEq>::Epsilon
§fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon ) -> bool
RelativeEq::relative_eq
].source§impl<T> RemoveRepeatedPoints<T> for Point<T>where
T: CoordNum + FromPrimitive,
impl<T> RemoveRepeatedPoints<T> for Point<T>where
T: CoordNum + FromPrimitive,
source§fn remove_repeated_points(&self) -> Self
fn remove_repeated_points(&self) -> Self
source§fn remove_repeated_points_mut(&mut self)
fn remove_repeated_points_mut(&mut self)
source§impl<T> RhumbBearing<T> for Point<T>where
T: CoordFloat + FromPrimitive,
impl<T> RhumbBearing<T> for Point<T>where
T: CoordFloat + FromPrimitive,
source§fn rhumb_bearing(&self, point: Point<T>) -> T
fn rhumb_bearing(&self, point: Point<T>) -> T
source§impl<T> RhumbDestination<T> for Point<T>where
T: CoordFloat + FromPrimitive,
impl<T> RhumbDestination<T> for Point<T>where
T: CoordFloat + FromPrimitive,
source§fn rhumb_destination(&self, bearing: T, distance: T) -> Point<T>
fn rhumb_destination(&self, bearing: T, distance: T) -> Point<T>
source§impl<T> RhumbDistance<T> for Point<T>where
T: CoordFloat + FromPrimitive,
impl<T> RhumbDistance<T> for Point<T>where
T: CoordFloat + FromPrimitive,
source§fn rhumb_distance(&self, rhs: &Point<T>) -> T
fn rhumb_distance(&self, rhs: &Point<T>) -> T
source§impl<T> RhumbIntermediate<T> for Point<T>where
T: CoordFloat + FromPrimitive,
impl<T> RhumbIntermediate<T> for Point<T>where
T: CoordFloat + FromPrimitive,
source§fn rhumb_intermediate(&self, other: &Point<T>, f: T) -> Point<T>
fn rhumb_intermediate(&self, other: &Point<T>, f: T) -> Point<T>
fn rhumb_intermediate_fill( &self, other: &Point<T>, max_dist: T, include_ends: bool ) -> Vec<Point<T>>
source§impl<T> Sub for Point<T>where
T: CoordNum,
impl<T> Sub for Point<T>where
T: CoordNum,
source§impl<T> SubAssign for Point<T>where
T: CoordNum,
impl<T> SubAssign for Point<T>where
T: CoordNum,
source§fn sub_assign(&mut self, rhs: Point<T>)
fn sub_assign(&mut self, rhs: Point<T>)
Subtract a point from the given point and assign it to the original point.
§Examples
use geo_types::Point;
let mut p = Point::new(1.25, 2.5);
p -= Point::new(1.5, 2.5);
assert_eq!(p.x(), -0.25);
assert_eq!(p.y(), 0.0);
source§impl<T> TryFrom<Geometry<T>> for Point<T>where
T: CoordNum,
impl<T> TryFrom<Geometry<T>> for Point<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
source§impl<T> VincentyDistance<T> for Point<T>where
T: CoordFloat + FromPrimitive,
impl<T> VincentyDistance<T> for Point<T>where
T: CoordFloat + FromPrimitive,
source§fn vincenty_distance(&self, rhs: &Point<T>) -> Result<T, FailedToConvergeError>
fn vincenty_distance(&self, rhs: &Point<T>) -> Result<T, FailedToConvergeError>
impl<T> Copy for Point<T>
impl<T> Eq for Point<T>
impl<T> StructuralPartialEq for Point<T>where
T: CoordNum,
Auto Trait Implementations§
impl<T> RefUnwindSafe for Point<T>where
T: RefUnwindSafe,
impl<T> Send for Point<T>where
T: Send,
impl<T> Sync for Point<T>where
T: Sync,
impl<T> Unpin for Point<T>where
T: Unpin,
impl<T> UnwindSafe for Point<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T, M> AffineOps<T> for M
impl<T, M> AffineOps<T> for M
source§fn affine_transform(&self, transform: &AffineTransform<T>) -> M
fn affine_transform(&self, transform: &AffineTransform<T>) -> M
transform
immutably, outputting a new geometry.source§fn affine_transform_mut(&mut self, transform: &AffineTransform<T>)
fn affine_transform_mut(&mut self, transform: &AffineTransform<T>)
transform
to mutate self
.source§impl<T, B> Bearing<T> for Bwhere
T: CoordFloat,
B: HaversineBearing<T>,
impl<T, B> Bearing<T> for Bwhere
T: CoordFloat,
B: HaversineBearing<T>,
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
source§impl<'a, T, G> ConvexHull<'a, T> for Gwhere
T: GeoNum,
G: CoordsIter<Scalar = T>,
impl<'a, T, G> ConvexHull<'a, T> for Gwhere
T: GeoNum,
G: CoordsIter<Scalar = T>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
source§impl<'a, T, G> Extremes<'a, T> for Gwhere
G: CoordsIter<Scalar = T>,
T: CoordNum,
impl<'a, T, G> Extremes<'a, T> for Gwhere
G: CoordsIter<Scalar = T>,
T: CoordNum,
source§impl<T, G> HausdorffDistance<T> for Gwhere
T: GeoFloat,
G: CoordsIter<Scalar = T>,
impl<T, G> HausdorffDistance<T> for Gwhere
T: GeoFloat,
G: CoordsIter<Scalar = T>,
fn hausdorff_distance<Rhs>(&self, rhs: &Rhs) -> Twhere
Rhs: CoordsIter<Scalar = T>,
source§impl<T, G> MinimumRotatedRect<T> for G
impl<T, G> MinimumRotatedRect<T> for G
type Scalar = T
fn minimum_rotated_rect( &self ) -> Option<Polygon<<G as MinimumRotatedRect<T>>::Scalar>>
source§impl<P> PointDistance for Pwhere
P: Point,
impl<P> PointDistance for Pwhere
P: Point,
source§fn distance_2(&self, point: &P) -> <P as Point>::Scalar
fn distance_2(&self, point: &P) -> <P as Point>::Scalar
source§fn contains_point(
&self,
point: &<<P as RTreeObject>::Envelope as Envelope>::Point
) -> bool
fn contains_point( &self, point: &<<P as RTreeObject>::Envelope as Envelope>::Point ) -> bool
true
if a point is contained within this object. Read moresource§fn distance_2_if_less_or_equal(
&self,
point: &<<P as RTreeObject>::Envelope as Envelope>::Point,
max_distance_2: <<<P as RTreeObject>::Envelope as Envelope>::Point as Point>::Scalar
) -> Option<<P as Point>::Scalar>
fn distance_2_if_less_or_equal( &self, point: &<<P as RTreeObject>::Envelope as Envelope>::Point, max_distance_2: <<<P as RTreeObject>::Envelope as Envelope>::Point as Point>::Scalar ) -> Option<<P as Point>::Scalar>
None
if the distance
is larger than a given maximum value. Read moresource§impl<P> RTreeObject for Pwhere
P: Point,
impl<P> RTreeObject for Pwhere
P: Point,
source§impl<G, IP, IR, T> Rotate<T> for G
impl<G, IP, IR, T> Rotate<T> for G
source§fn rotate_around_centroid(&self, degrees: T) -> G
fn rotate_around_centroid(&self, degrees: T) -> G
source§fn rotate_around_centroid_mut(&mut self, degrees: T)
fn rotate_around_centroid_mut(&mut self, degrees: T)
Self::rotate_around_centroid
source§fn rotate_around_center(&self, degrees: T) -> G
fn rotate_around_center(&self, degrees: T) -> G
source§fn rotate_around_center_mut(&mut self, degrees: T)
fn rotate_around_center_mut(&mut self, degrees: T)
Self::rotate_around_center
source§fn rotate_around_point(&self, degrees: T, point: Point<T>) -> G
fn rotate_around_point(&self, degrees: T, point: Point<T>) -> G
source§fn rotate_around_point_mut(&mut self, degrees: T, point: Point<T>)
fn rotate_around_point_mut(&mut self, degrees: T, point: Point<T>)
Self::rotate_around_point
source§impl<T, IR, G> Scale<T> for Gwhere
T: CoordFloat,
IR: Into<Option<Rect<T>>>,
G: Clone + AffineOps<T> + BoundingRect<T, Output = IR>,
impl<T, IR, G> Scale<T> for Gwhere
T: CoordFloat,
IR: Into<Option<Rect<T>>>,
G: Clone + AffineOps<T> + BoundingRect<T, Output = IR>,
source§fn scale(&self, scale_factor: T) -> G
fn scale(&self, scale_factor: T) -> G
source§fn scale_xy(&self, x_factor: T, y_factor: T) -> G
fn scale_xy(&self, x_factor: T, y_factor: T) -> G
x_factor
and
y_factor
to distort the geometry’s aspect ratio. Read moresource§fn scale_xy_mut(&mut self, x_factor: T, y_factor: T)
fn scale_xy_mut(&mut self, x_factor: T, y_factor: T)
scale_xy
.source§fn scale_around_point(
&self,
x_factor: T,
y_factor: T,
origin: impl Into<Coord<T>>
) -> G
fn scale_around_point( &self, x_factor: T, y_factor: T, origin: impl Into<Coord<T>> ) -> G
origin
. Read moresource§fn scale_around_point_mut(
&mut self,
x_factor: T,
y_factor: T,
origin: impl Into<Coord<T>>
)
fn scale_around_point_mut( &mut self, x_factor: T, y_factor: T, origin: impl Into<Coord<T>> )
scale_around_point
.source§impl<T, IR, G> Skew<T> for Gwhere
T: CoordFloat,
IR: Into<Option<Rect<T>>>,
G: Clone + AffineOps<T> + BoundingRect<T, Output = IR>,
impl<T, IR, G> Skew<T> for Gwhere
T: CoordFloat,
IR: Into<Option<Rect<T>>>,
G: Clone + AffineOps<T> + BoundingRect<T, Output = IR>,
source§fn skew(&self, degrees: T) -> G
fn skew(&self, degrees: T) -> G
source§fn skew_xy(&self, degrees_x: T, degrees_y: T) -> G
fn skew_xy(&self, degrees_x: T, degrees_y: T) -> G
source§fn skew_xy_mut(&mut self, degrees_x: T, degrees_y: T)
fn skew_xy_mut(&mut self, degrees_x: T, degrees_y: T)
skew_xy
.source§fn skew_around_point(&self, xs: T, ys: T, origin: impl Into<Coord<T>>) -> G
fn skew_around_point(&self, xs: T, ys: T, origin: impl Into<Coord<T>>) -> G
origin
, sheared by an
angle along the x and y dimensions. Read moresource§fn skew_around_point_mut(&mut self, xs: T, ys: T, origin: impl Into<Coord<T>>)
fn skew_around_point_mut(&mut self, xs: T, ys: T, origin: impl Into<Coord<T>>)
skew_around_point
.