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
Source§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<F: GeoFloat> Distance<F, &GeometryCollection<F>, &Point<F>> for Euclidean
impl<F: GeoFloat> Distance<F, &GeometryCollection<F>, &Point<F>> for Euclidean
Source§fn distance(iter_geometry: &GeometryCollection<F>, to_geometry: &Point<F>) -> F
fn distance(iter_geometry: &GeometryCollection<F>, to_geometry: &Point<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F> Distance<F, &LineString<F>, &Point<F>> for Euclideanwhere
F: CoordFloat,
impl<F> Distance<F, &LineString<F>, &Point<F>> for Euclideanwhere
F: CoordFloat,
Source§fn distance(a: &LineString<F>, b: &Point<F>) -> F
fn distance(a: &LineString<F>, b: &Point<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F: GeoFloat> Distance<F, &MultiLineString<F>, &Point<F>> for Euclidean
impl<F: GeoFloat> Distance<F, &MultiLineString<F>, &Point<F>> for Euclidean
Source§fn distance(iter_geometry: &MultiLineString<F>, to_geometry: &Point<F>) -> F
fn distance(iter_geometry: &MultiLineString<F>, to_geometry: &Point<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F: GeoFloat> Distance<F, &MultiPoint<F>, &Point<F>> for Euclidean
impl<F: GeoFloat> Distance<F, &MultiPoint<F>, &Point<F>> for Euclidean
Source§fn distance(iter_geometry: &MultiPoint<F>, to_geometry: &Point<F>) -> F
fn distance(iter_geometry: &MultiPoint<F>, to_geometry: &Point<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F: GeoFloat> Distance<F, &MultiPolygon<F>, &Point<F>> for Euclidean
impl<F: GeoFloat> Distance<F, &MultiPolygon<F>, &Point<F>> for Euclidean
Source§fn distance(iter_geometry: &MultiPolygon<F>, to_geometry: &Point<F>) -> F
fn distance(iter_geometry: &MultiPolygon<F>, to_geometry: &Point<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F> Distance<F, &Point<F>, &GeometryCollection<F>> for Euclideanwhere
F: GeoFloat,
impl<F> Distance<F, &Point<F>, &GeometryCollection<F>> for Euclideanwhere
F: GeoFloat,
Source§fn distance(a: &Point<F>, b: &GeometryCollection<F>) -> F
fn distance(a: &Point<F>, b: &GeometryCollection<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F: CoordFloat> Distance<F, &Point<F>, &LineString<F>> for Euclidean
impl<F: CoordFloat> Distance<F, &Point<F>, &LineString<F>> for Euclidean
Source§fn distance(origin: &Point<F>, destination: &LineString<F>) -> F
fn distance(origin: &Point<F>, destination: &LineString<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F> Distance<F, &Point<F>, &MultiLineString<F>> for Euclideanwhere
F: GeoFloat,
impl<F> Distance<F, &Point<F>, &MultiLineString<F>> for Euclideanwhere
F: GeoFloat,
Source§fn distance(a: &Point<F>, b: &MultiLineString<F>) -> F
fn distance(a: &Point<F>, b: &MultiLineString<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F> Distance<F, &Point<F>, &MultiPoint<F>> for Euclideanwhere
F: GeoFloat,
impl<F> Distance<F, &Point<F>, &MultiPoint<F>> for Euclideanwhere
F: GeoFloat,
Source§fn distance(a: &Point<F>, b: &MultiPoint<F>) -> F
fn distance(a: &Point<F>, b: &MultiPoint<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F> Distance<F, &Point<F>, &MultiPolygon<F>> for Euclideanwhere
F: GeoFloat,
impl<F> Distance<F, &Point<F>, &MultiPolygon<F>> for Euclideanwhere
F: GeoFloat,
Source§fn distance(a: &Point<F>, b: &MultiPolygon<F>) -> F
fn distance(a: &Point<F>, b: &MultiPolygon<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F: CoordFloat> Distance<F, Point<F>, Point<F>> for Euclidean
impl<F: CoordFloat> Distance<F, Point<F>, Point<F>> for Euclidean
Calculate the Euclidean distance (a.k.a. pythagorean distance) between two Points
Source§fn distance(origin: Point<F>, destination: Point<F>) -> F
fn distance(origin: Point<F>, destination: Point<F>) -> F
Calculate the Euclidean distance (a.k.a. pythagorean distance) between two Points
§Units
origin
,destination
: Point where the units of x/y represent non-angular units — e.g. meters or miles, not lon/lat. For lon/lat points, use theHaversine
orGeodesic
metric spaces.- returns: distance in the same units as the
origin
anddestination
points
§Example
use geo::{Euclidean, Distance};
use geo::Point;
// web mercator
let new_york_city = Point::new(-8238310.24, 4942194.78);
// web mercator
let london = Point::new(-14226.63, 6678077.70);
let distance: f64 = Euclidean::distance(new_york_city, london);
assert_eq!(
8_405_286., // meters in web mercator
distance.round()
);
Source§impl<F: CoordFloat + FromPrimitive> Distance<F, Point<F>, Point<F>> for Haversine
impl<F: CoordFloat + FromPrimitive> Distance<F, Point<F>, Point<F>> for Haversine
Source§fn distance(origin: Point<F>, destination: Point<F>) -> F
fn distance(origin: Point<F>, destination: Point<F>) -> F
Determine the distance between two points using the haversine formula.
§Units
origin
,destination
: Points where x/y are lon/lat degree coordinates- returns: meters
§Examples
use geo::{Haversine, Distance};
use geo::Point;
let new_york_city = Point::new(-74.006f64, 40.7128f64);
let london = Point::new(-0.1278f64, 51.5074f64);
let distance = Haversine::distance(new_york_city, london);
assert_relative_eq!(
5_570_230., // meters
distance.round()
);
§References
Note: this implementation uses a mean earth radius of 6371.088 km, based on the recommendation of the IUGG
Source§impl<F: CoordFloat + FromPrimitive> Distance<F, Point<F>, Point<F>> for Rhumb
impl<F: CoordFloat + FromPrimitive> Distance<F, Point<F>, Point<F>> for Rhumb
Source§fn distance(origin: Point<F>, destination: Point<F>) -> F
fn distance(origin: Point<F>, destination: Point<F>) -> F
Determine the distance along the rhumb line between two points.
§Units
origin
,destination
: Points where x/y are lon/lat degree coordinates- returns: meters
§Examples
use geo::{Rhumb, Distance};
use geo::point;
// New York City
let p1 = point!(x: -74.006f64, y: 40.7128);
// London
let p2 = point!(x: -0.1278, y: 51.5074);
let distance = Rhumb::distance(p1, p2);
assert_eq!(
5_794_129., // meters
distance.round()
);
Source§impl Distance<f64, Point, Point> for Geodesic
impl Distance<f64, Point, Point> for Geodesic
Source§fn distance(origin: Point<f64>, destination: Point<f64>) -> f64
fn distance(origin: Point<f64>, destination: Point<f64>) -> f64
Determine the length of the geodesic line between two geometries on an ellipsoidal model of the earth.
§Units
origin
,destination
: Point where x/y are lon/lat degree coordinates/- returns: meters
§Examples
use geo::{Geodesic, Distance};
use geo::Point;
// New York City
let new_york_city = Point::new(-74.006, 40.7128);
// London
let london = Point::new(-0.1278, 51.5074);
let distance = Geodesic::distance(new_york_city, london);
assert_eq!(
5_585_234., // meters
distance.round()
);
§References
This uses the geodesic methods given by Karney (2013).
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
👎Deprecated since 0.29.0: Please use the Euclidean::distance
method from the Distance
trait instead
fn euclidean_distance(&self, p: &Point<T>) -> T
Euclidean::distance
method from the Distance
trait insteadMinimum 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
Euclidean::distance
method from the Distance
trait insteadSource§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
Euclidean::distance
method from the Distance
trait insteadSource§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
👎Deprecated since 0.29.0: Please use the Euclidean::distance
method from the Distance
trait instead
fn euclidean_distance(&self, line: &Line<T>) -> T
Euclidean::distance
method from the Distance
trait insteadMinimum 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, line_string: &LineString<T>) -> T
👎Deprecated since 0.29.0: Please use the Euclidean::distance
method from the Distance
trait instead
fn euclidean_distance(&self, line_string: &LineString<T>) -> T
Euclidean::distance
method from the Distance
trait insteadMinimum 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
Euclidean::distance
method from the Distance
trait insteadSource§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
Euclidean::distance
method from the Distance
trait insteadSource§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
Euclidean::distance
method from the Distance
trait insteadSource§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
Euclidean::distance
method from the Distance
trait insteadSource§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
Euclidean::distance
method from the Distance
trait insteadSource§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
👎Deprecated since 0.29.0: Please use the Euclidean::distance
method from the Distance
trait instead
fn euclidean_distance(&self, point: &Point<T>) -> T
Euclidean::distance
method from the Distance
trait insteadMinimum 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
👎Deprecated since 0.29.0: Please use the Euclidean::distance
method from the Distance
trait instead
fn euclidean_distance(&self, point: &Point<T>) -> T
Euclidean::distance
method from the Distance
trait insteadMinimum 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
Euclidean::distance
method from the Distance
trait insteadSource§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
Euclidean::distance
method from the Distance
trait insteadSource§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
Euclidean::distance
method from the Distance
trait insteadSource§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
👎Deprecated since 0.29.0: Please use the Euclidean::distance
method from the Distance
trait instead
fn euclidean_distance(&self, point: &Point<T>) -> T
Euclidean::distance
method from the Distance
trait insteadMinimum 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
Euclidean::distance
method from the Distance
trait insteadSource§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
Euclidean::distance
method from the Distance
trait insteadSource§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
👎Deprecated since 0.29.0: Please use the Euclidean::distance
method from the Distance
trait instead
fn euclidean_distance(&self, polygon: &Polygon<T>) -> T
Euclidean::distance
method from the Distance
trait insteadMinimum 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
Euclidean::distance
method from the Distance
trait insteadSource§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
Euclidean::distance
method from the Distance
trait insteadSource§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
Haversine::bearing
method from the Bearing
trait insteadSource§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>
Haversine::destination
method from the Destination
trait insteadSource§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
Haversine::distance
method from the Distance
trait insteadSource§impl<T> HaversineIntermediate<T> for Point<T>where
T: CoordFloat + FromPrimitive,
impl<T> HaversineIntermediate<T> for Point<T>where
T: CoordFloat + FromPrimitive,
Source§fn haversine_intermediate(&self, other: &Point<T>, ratio: T) -> Point<T>
fn haversine_intermediate(&self, other: &Point<T>, ratio: T) -> Point<T>
Haversine::point_at_ratio_between
from the InterpolatePoint
trait insteadSource§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> 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> for Point<F>
impl<F: GeoFloat> Relate<F> for Point<F>
Source§fn geometry_graph(&self, arg_index: usize) -> GeometryGraph<'_, F>
fn geometry_graph(&self, arg_index: usize) -> GeometryGraph<'_, F>
GeometryGraph
fn relate(&self, other: &impl Relate<F>) -> IntersectionMatrix
Source§impl<T> RelativeEq for Point<T>
impl<T> RelativeEq for Point<T>
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
Source§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
Rhumb::bearing
method from the Bearing
trait insteadSource§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>
Rhumb::destination
method from the Destination
trait insteadSource§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
Rhumb::distance
method from the Distance
trait insteadSource§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>
Rhumb::point_at_ratio_between
from the InterpolatePoint
trait insteadSource§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> Freeze for Point<T>where
T: Freeze,
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> 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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§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<T> Pointable for T
impl<T> Pointable for T
Source§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
.