geo::geometry

Struct Point

Source
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,

Source

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);
Source

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);
Source

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);
Source

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);
Source

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);
Source

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);
Source

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);
Source

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);
Source

pub fn lng(self) -> T

👎Deprecated: use Point::x instead, it’s less ambiguous

Returns 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);
Source

pub fn set_lng(&mut self, lng: T) -> &mut Point<T>

👎Deprecated: use Point::set_x instead, it’s less ambiguous

Sets 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

pub fn lat(self) -> T

👎Deprecated: use Point::y instead, it’s less ambiguous

Returns the latitude/vertical component of the point.

§Examples
use geo_types::Point;

let p = Point::new(1.234, 2.345);

assert_eq!(p.y(), 2.345);
Source

pub fn set_lat(&mut self, lat: T) -> &mut Point<T>

👎Deprecated: use Point::set_y instead, it’s less ambiguous

Sets the latitude/vertical component of the point.

§Examples
use geo_types::Point;

let mut p = Point::new(1.234, 2.345);
#[allow(deprecated)]
p.set_lat(9.876);

assert_eq!(p.y(), 9.876);
Source§

impl<T> Point<T>
where T: CoordNum,

Source

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);
Source

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 selfpoint_bpoint_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,

Source

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);
Source

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>
where T: AbsDiffEq<Epsilon = T> + CoordNum, <T as AbsDiffEq>::Epsilon: Copy,

Source§

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§

type Epsilon = <T as AbsDiffEq>::Epsilon

Used for specifying relative comparisons.
Source§

fn default_epsilon() -> <Point<T> as AbsDiffEq>::Epsilon

The default tolerance to use when testing values that are close together. Read more
Source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of AbsDiffEq::abs_diff_eq.
Source§

impl<T> Add for Point<T>
where T: CoordNum,

Source§

fn add(self, rhs: Point<T>) -> <Point<T> as Add>::Output

Add a point to the given point.

§Examples
use geo_types::Point;

let p = Point::new(1.25, 2.5) + Point::new(1.5, 2.5);

assert_eq!(p.x(), 2.75);
assert_eq!(p.y(), 5.0);
Source§

type Output = Point<T>

The resulting type after applying the + operator.
Source§

impl<T> AddAssign for Point<T>
where T: CoordNum,

Source§

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,

Source§

fn signed_area(&self) -> T

Source§

fn unsigned_area(&self) -> T

Source§

impl<T> BoundingRect<T> for Point<T>
where T: CoordNum,

Source§

fn bounding_rect(&self) -> Self::Output

Return the bounding rectangle for a Point. It will have zero width and zero height.

Source§

type Output = Rect<T>

Source§

impl<T> Centroid for Point<T>
where T: GeoFloat,

Source§

fn centroid(&self) -> Self::Output

The Centroid of a Point is the point itself

§Examples
use geo::Centroid;
use geo::point;

let point = point!(x: 1.0f32, y: 2.0);

assert_eq!(
    point!(x: 1.0f32, y: 2.0),
    point.centroid(),
);
Source§

type Output = Point<T>

Source§

impl<T> ChamberlainDuquetteArea<T> for Point<T>
where T: CoordFloat,

Source§

impl<T> Clone for Point<T>
where T: Clone + CoordNum,

Source§

fn clone(&self) -> Point<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F: GeoFloat> ClosestPoint<F> for Point<F>

Source§

fn closest_point(&self, p: &Self) -> Closest<F>

Find the closest point between self and p.
Source§

impl<T> Contains<Coord<T>> for Point<T>
where T: CoordNum,

Source§

fn contains(&self, coord: &Coord<T>) -> bool

Source§

impl<T> Contains<Geometry<T>> for Point<T>
where T: GeoFloat,

Source§

fn contains(&self, geometry: &Geometry<T>) -> bool

Source§

impl<T> Contains<GeometryCollection<T>> for Point<T>
where T: GeoFloat,

Source§

fn contains(&self, geometry_collection: &GeometryCollection<T>) -> bool

Source§

impl<T> Contains<Line<T>> for Point<T>
where T: CoordNum,

Source§

fn contains(&self, line: &Line<T>) -> bool

Source§

impl<T> Contains<LineString<T>> for Point<T>
where T: CoordNum,

Source§

fn contains(&self, line_string: &LineString<T>) -> bool

Source§

impl<T> Contains<MultiLineString<T>> for Point<T>
where T: CoordNum,

Source§

fn contains(&self, multi_line_string: &MultiLineString<T>) -> bool

Source§

impl<T> Contains<MultiPoint<T>> for Point<T>
where T: CoordNum,

Source§

fn contains(&self, multi_point: &MultiPoint<T>) -> bool

Source§

impl<T> Contains<MultiPolygon<T>> for Point<T>
where T: CoordNum,

Source§

fn contains(&self, multi_polygon: &MultiPolygon<T>) -> bool

Source§

impl<T> Contains<Point<T>> for Geometry<T>
where T: GeoNum,

Source§

fn contains(&self, point: &Point<T>) -> bool

Source§

impl<T> Contains<Point<T>> for GeometryCollection<T>
where T: GeoNum,

Source§

fn contains(&self, point: &Point<T>) -> bool

Source§

impl<T> Contains<Point<T>> for Line<T>
where T: GeoNum,

Source§

fn contains(&self, p: &Point<T>) -> bool

Source§

impl<T> Contains<Point<T>> for LineString<T>
where T: GeoNum,

Source§

fn contains(&self, p: &Point<T>) -> bool

Source§

impl<T> Contains<Point<T>> for MultiLineString<T>
where T: CoordNum, LineString<T>: Contains<Point<T>>,

Source§

fn contains(&self, rhs: &Point<T>) -> bool

Source§

impl<T> Contains<Point<T>> for MultiPoint<T>
where T: CoordNum,

Source§

fn contains(&self, point: &Point<T>) -> bool

Source§

impl<T> Contains<Point<T>> for MultiPolygon<T>
where T: GeoNum,

Source§

fn contains(&self, p: &Point<T>) -> bool

Source§

impl<T> Contains<Point<T>> for Polygon<T>
where T: GeoNum,

Source§

fn contains(&self, p: &Point<T>) -> bool

Source§

impl<T> Contains<Point<T>> for Rect<T>
where T: CoordNum,

Source§

fn contains(&self, p: &Point<T>) -> bool

Source§

impl<T> Contains<Point<T>> for Triangle<T>
where T: GeoNum,

Source§

fn contains(&self, point: &Point<T>) -> bool

Source§

impl<T> Contains<Polygon<T>> for Point<T>
where T: CoordNum,

Source§

fn contains(&self, polygon: &Polygon<T>) -> bool

Source§

impl<T> Contains<Rect<T>> for Point<T>
where T: CoordNum,

Source§

fn contains(&self, rect: &Rect<T>) -> bool

Source§

impl<T> Contains<Triangle<T>> for Point<T>
where T: CoordNum,

Source§

fn contains(&self, triangle: &Triangle<T>) -> bool

Source§

impl<T> Contains for Point<T>
where T: CoordNum,

Source§

fn contains(&self, p: &Point<T>) -> bool

Source§

impl<T> CoordinatePosition for Point<T>
where T: GeoNum,

Source§

type Scalar = T

Source§

fn calculate_coordinate_position( &self, coord: &Coord<T>, is_inside: &mut bool, _boundary_count: &mut usize, )

Source§

fn coordinate_position(&self, coord: &Coord<Self::Scalar>) -> CoordPos

Source§

impl<T: CoordNum> CoordsIter for Point<T>

Source§

fn coords_count(&self) -> usize

Return the number of coordinates in the Point.

Source§

type Iter<'a> = Once<Coord<T>> where T: 'a

Source§

type ExteriorIter<'a> = <Point<T> as CoordsIter>::Iter<'a> where T: 'a

Source§

type Scalar = T

Source§

fn coords_iter(&self) -> Self::Iter<'_>

Iterate over all exterior and (if any) interior coordinates of a geometry. Read more
Source§

fn exterior_coords_iter(&self) -> Self::ExteriorIter<'_>

Iterate over all exterior coordinates of a geometry. Read more
Source§

impl<T> CrossTrackDistance<T> for Point<T>

Source§

fn cross_track_distance( &self, line_point_a: &Point<T>, line_point_b: &Point<T>, ) -> T

Determine the cross track distance between this point and a line which passes through line_point_a and line_point_b Read more
Source§

impl<T> Debug for Point<T>
where T: Debug + CoordNum,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> Default for Point<T>
where T: Default + CoordNum,

Source§

fn default() -> Point<T>

Returns the “default value” for a type. Read more
Source§

impl<F> Distance<F, &Geometry<F>, &Point<F>> for Euclidean
where F: GeoFloat,

Source§

fn distance(a: &Geometry<F>, b: &Point<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F: GeoFloat> Distance<F, &GeometryCollection<F>, &Point<F>> for Euclidean

Source§

fn distance(iter_geometry: &GeometryCollection<F>, to_geometry: &Point<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F> Distance<F, &Line<F>, &Point<F>> for Euclidean
where F: CoordFloat,

Source§

fn distance(a: &Line<F>, b: &Point<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F> Distance<F, &LineString<F>, &Point<F>> for Euclidean
where F: CoordFloat,

Source§

fn distance(a: &LineString<F>, b: &Point<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F: GeoFloat> Distance<F, &MultiLineString<F>, &Point<F>> for Euclidean

Source§

fn distance(iter_geometry: &MultiLineString<F>, to_geometry: &Point<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F: GeoFloat> Distance<F, &MultiPoint<F>, &Point<F>> for Euclidean

Source§

fn distance(iter_geometry: &MultiPoint<F>, to_geometry: &Point<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F: GeoFloat> Distance<F, &MultiPolygon<F>, &Point<F>> for Euclidean

Source§

fn distance(iter_geometry: &MultiPolygon<F>, to_geometry: &Point<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F: GeoFloat> Distance<F, &Point<F>, &Geometry<F>> for Euclidean

Source§

fn distance(origin: &Point<F>, destination: &Geometry<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F> Distance<F, &Point<F>, &GeometryCollection<F>> for Euclidean
where F: GeoFloat,

Source§

fn distance(a: &Point<F>, b: &GeometryCollection<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F: CoordFloat> Distance<F, &Point<F>, &Line<F>> for Euclidean

Source§

fn distance(origin: &Point<F>, destination: &Line<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F: CoordFloat> Distance<F, &Point<F>, &LineString<F>> for Euclidean

Source§

fn distance(origin: &Point<F>, destination: &LineString<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F> Distance<F, &Point<F>, &MultiLineString<F>> for Euclidean
where F: GeoFloat,

Source§

fn distance(a: &Point<F>, b: &MultiLineString<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F> Distance<F, &Point<F>, &MultiPoint<F>> for Euclidean
where F: GeoFloat,

Source§

fn distance(a: &Point<F>, b: &MultiPoint<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F> Distance<F, &Point<F>, &MultiPolygon<F>> for Euclidean
where F: GeoFloat,

Source§

fn distance(a: &Point<F>, b: &MultiPolygon<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F: CoordFloat> Distance<F, &Point<F>, &Point<F>> for Euclidean

Source§

fn distance(origin: &Point<F>, destination: &Point<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F: GeoFloat> Distance<F, &Point<F>, &Polygon<F>> for Euclidean

Source§

fn distance(point: &Point<F>, polygon: &Polygon<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F> Distance<F, &Point<F>, &Rect<F>> for Euclidean
where F: GeoFloat,

Source§

fn distance(a: &Point<F>, b: &Rect<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F> Distance<F, &Point<F>, &Triangle<F>> for Euclidean
where F: GeoFloat,

Source§

fn distance(a: &Point<F>, b: &Triangle<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F> Distance<F, &Polygon<F>, &Point<F>> for Euclidean
where F: GeoFloat,

Source§

fn distance(a: &Polygon<F>, b: &Point<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F: GeoFloat> Distance<F, &Rect<F>, &Point<F>> for Euclidean

Source§

fn distance(polygonlike: &Rect<F>, geometry_b: &Point<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

impl<F: GeoFloat> Distance<F, &Triangle<F>, &Point<F>> for Euclidean

Source§

fn distance(polygonlike: &Triangle<F>, geometry_b: &Point<F>) -> F

Note that not all implementations support all geometry combinations, but at least Point to Point is supported. See specific implementations for details. Read more
Source§

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

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 the Haversine or Geodesic metric spaces.
  • returns: distance in the same units as the origin and destination 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

Source§

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

Source§

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

Source§

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> Div<T> for Point<T>
where T: CoordNum,

Source§

fn div(self, rhs: T) -> <Point<T> as Div<T>>::Output

Scaler division of a point

§Examples
use geo_types::Point;

let p = Point::new(2.0, 3.0) / 2.0;

assert_eq!(p.x(), 1.0);
assert_eq!(p.y(), 1.5);
Source§

type Output = Point<T>

The resulting type after applying the / operator.
Source§

impl<T> DivAssign<T> for Point<T>
where T: CoordNum,

Source§

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,

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

Minimum distance between two Points

Source§

impl<T> EuclideanDistance<T, Geometry<T>> for Point<T>

Source§

fn euclidean_distance(&self, geom: &Geometry<T>) -> T

👎Deprecated since 0.29.0: Please use the Euclidean::distance method from the Distance trait instead
Returns the distance between two geometries Read more
Source§

impl<T> EuclideanDistance<T, GeometryCollection<T>> for Point<T>

Source§

fn euclidean_distance(&self, target: &GeometryCollection<T>) -> T

👎Deprecated since 0.29.0: Please use the Euclidean::distance method from the Distance trait instead
Returns the distance between two geometries Read more
Source§

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

Minimum distance from a Line to a Point

Source§

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

Minimum distance from a Point to a LineString

Source§

impl<T> EuclideanDistance<T, MultiLineString<T>> for Point<T>

Source§

fn euclidean_distance(&self, target: &MultiLineString<T>) -> T

👎Deprecated since 0.29.0: Please use the Euclidean::distance method from the Distance trait instead
Returns the distance between two geometries Read more
Source§

impl<T> EuclideanDistance<T, MultiPoint<T>> for Point<T>

Source§

fn euclidean_distance(&self, target: &MultiPoint<T>) -> T

👎Deprecated since 0.29.0: Please use the Euclidean::distance method from the Distance trait instead
Returns the distance between two geometries Read more
Source§

impl<T> EuclideanDistance<T, MultiPolygon<T>> for Point<T>

Source§

fn euclidean_distance(&self, target: &MultiPolygon<T>) -> T

👎Deprecated since 0.29.0: Please use the Euclidean::distance method from the Distance trait instead
Returns the distance between two geometries Read more
Source§

impl<T> EuclideanDistance<T, Point<T>> for Geometry<T>

Source§

fn euclidean_distance(&self, other: &Point<T>) -> T

👎Deprecated since 0.29.0: Please use the Euclidean::distance method from the Distance trait instead
Returns the distance between two geometries Read more
Source§

impl<T> EuclideanDistance<T, Point<T>> for GeometryCollection<T>

Source§

fn euclidean_distance(&self, target: &Point<T>) -> T

👎Deprecated since 0.29.0: Please use the Euclidean::distance method from the Distance trait instead
Returns the distance between two geometries Read more
Source§

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

Minimum distance from a Line to a Point

Source§

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

Minimum distance from a LineString to a Point

Source§

impl<T> EuclideanDistance<T, Point<T>> for MultiLineString<T>

Source§

fn euclidean_distance(&self, target: &Point<T>) -> T

👎Deprecated since 0.29.0: Please use the Euclidean::distance method from the Distance trait instead
Returns the distance between two geometries Read more
Source§

impl<T> EuclideanDistance<T, Point<T>> for MultiPoint<T>

Source§

fn euclidean_distance(&self, target: &Point<T>) -> T

👎Deprecated since 0.29.0: Please use the Euclidean::distance method from the Distance trait instead
Returns the distance between two geometries Read more
Source§

impl<T> EuclideanDistance<T, Point<T>> for MultiPolygon<T>

Source§

fn euclidean_distance(&self, target: &Point<T>) -> T

👎Deprecated since 0.29.0: Please use the Euclidean::distance method from the Distance trait instead
Returns the distance between two geometries Read more
Source§

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

Minimum distance from a Polygon to a Point

Source§

impl<T> EuclideanDistance<T, Point<T>> for Rect<T>

Source§

fn euclidean_distance(&self, other: &Point<T>) -> T

👎Deprecated since 0.29.0: Please use the Euclidean::distance method from the Distance trait instead
Returns the distance between two geometries Read more
Source§

impl<T> EuclideanDistance<T, Point<T>> for Triangle<T>

Source§

fn euclidean_distance(&self, other: &Point<T>) -> T

👎Deprecated since 0.29.0: Please use the Euclidean::distance method from the Distance trait instead
Returns the distance between two geometries Read more
Source§

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

Minimum distance from a Point to a Polygon

Source§

impl<T> EuclideanDistance<T, Rect<T>> for Point<T>

Source§

fn euclidean_distance(&self, other: &Rect<T>) -> T

👎Deprecated since 0.29.0: Please use the Euclidean::distance method from the Distance trait instead
Returns the distance between two geometries Read more
Source§

impl<T> EuclideanDistance<T, Triangle<T>> for Point<T>

Source§

fn euclidean_distance(&self, other: &Triangle<T>) -> T

👎Deprecated since 0.29.0: Please use the Euclidean::distance method from the Distance trait instead
Returns the distance between two geometries Read more
Source§

impl<'a, F: GeoFloat> From<&'a Point<F>> for PreparedGeometry<'a, F>

Source§

fn from(point: &'a Point<F>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<[T; 2]> for Point<T>
where T: CoordNum,

Source§

fn from(coords: [T; 2]) -> Point<T>

Converts to this type from the input type.
Source§

impl<T> From<(T, T)> for Point<T>
where T: CoordNum,

Source§

fn from(coords: (T, T)) -> Point<T>

Converts to this type from the input type.
Source§

impl<T> From<Coord<T>> for Point<T>
where T: CoordNum,

Source§

fn from(x: Coord<T>) -> Point<T>

Converts to this type from the input type.
Source§

impl<'a, F: GeoFloat> From<Point<F>> for PreparedGeometry<'a, F>

Source§

fn from(point: Point<F>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Point<T>> for Coord<T>
where T: CoordNum,

Source§

fn from(point: Point<T>) -> Coord<T>

Converts to this type from the input type.
Source§

impl<T> From<Point<T>> for Geometry<T>
where T: CoordNum,

Source§

fn from(x: Point<T>) -> Geometry<T>

Converts to this type from the input type.
Source§

impl GeodesicArea<f64> for Point

Source§

fn geodesic_perimeter(&self) -> f64

Determine the perimeter of a geometry on an ellipsoidal model of the earth. Read more
Source§

fn geodesic_area_signed(&self) -> f64

Determine the area of a geometry on an ellipsoidal model of the earth. Read more
Source§

fn geodesic_area_unsigned(&self) -> f64

Determine the area of a geometry on an ellipsoidal model of the earth. Supports very large geometries that cover a significant portion of the earth. Read more
Source§

fn geodesic_perimeter_area_signed(&self) -> (f64, f64)

Determine the perimeter and area of a geometry on an ellipsoidal model of the earth, all in one operation. Read more
Source§

fn geodesic_perimeter_area_unsigned(&self) -> (f64, f64)

Determine the perimeter and area of a geometry on an ellipsoidal model of the earth, all in one operation. Supports very large geometries that cover a significant portion of the earth. Read more
Source§

impl GeodesicBearing<f64> for Point<f64>

Source§

fn geodesic_bearing(&self, rhs: Point<f64>) -> f64

👎Deprecated since 0.29.0: Please use the Geodesic::bearing method from the Bearing trait instead
Returns the bearing to another Point in degrees, where North is 0° and East is 90°. Read more
Source§

fn geodesic_bearing_distance(&self, rhs: Point<f64>) -> (f64, f64)

Returns the bearing and distance to another Point in a (bearing, distance) tuple. Read more
Source§

impl GeodesicDestination<f64> for Point<f64>

Source§

fn geodesic_destination(&self, bearing: f64, distance: f64) -> Point<f64>

👎Deprecated since 0.29.0: Please use the Geodesic::destination method from the Destination trait instead
Returns a new Point using distance to the existing Point and a bearing for the direction. Read more
Source§

impl GeodesicDistance<f64> for Point

Source§

fn geodesic_distance(&self, rhs: &Point) -> f64

👎Deprecated since 0.29.0: Please use the Geodesic::distance method from the Distance trait instead
Determine the distance between two geometries on an ellipsoidal model of the earth. Read more
Source§

impl GeodesicIntermediate<f64> for Point

Source§

fn geodesic_intermediate(&self, other: &Point, f: f64) -> Point

👎Deprecated since 0.29.0: Please use Geodesic::point_at_ratio_between from the InterpolatePoint trait instead
Returns a new Point along a route between two existing points on an ellipsoidal model of the earth Read more
Source§

fn geodesic_intermediate_fill( &self, other: &Point, max_dist: f64, include_ends: bool, ) -> Vec<Point>

👎Deprecated since 0.29.0: Please use Geodesic::points_along_line from the InterpolatePoint trait instead
Source§

impl<C: CoordNum> HasDimensions for Point<C>

Source§

fn is_empty(&self) -> bool

Some geometries, like a MultiPoint, can have zero coordinates - we call these empty. Read more
Source§

fn dimensions(&self) -> Dimensions

The dimensions of some geometries are fixed, e.g. a Point always has 0 dimensions. However for others, the dimensionality depends on the specific geometry instance - for example typical Rects are 2-dimensional, but it’s possible to create degenerate Rects which have either 1 or 0 dimensions. Read more
Source§

fn boundary_dimensions(&self) -> Dimensions

The dimensions of the Geometry’s boundary, as used by OGC-SFA. Read more
Source§

impl<T> Hash for Point<T>
where T: Hash + CoordNum,

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> HaversineBearing<T> for Point<T>
where T: CoordFloat,

Source§

fn haversine_bearing(&self, point: Point<T>) -> T

👎Deprecated since 0.29.0: Please use the Haversine::bearing method from the Bearing trait instead
Returns the bearing to another Point in degrees, where North is 0° and East is 90°. Read more
Source§

impl<T> HaversineClosestPoint<T> for Point<T>

Source§

impl<T> HaversineDestination<T> for Point<T>

Source§

fn haversine_destination(&self, bearing: T, distance: T) -> Point<T>

👎Deprecated since 0.29.0: Please use the Haversine::destination method from the Destination trait instead
Returns a new Point using distance to the existing Point and a bearing for the direction Read more
Source§

impl<T> HaversineDistance<T> for Point<T>

Source§

fn haversine_distance(&self, rhs: &Point<T>) -> T

👎Deprecated since 0.29.0: Please use the Haversine::distance method from the Distance trait instead
Determine the distance between two geometries using the haversine formula. Read more
Source§

impl<T> HaversineIntermediate<T> for Point<T>

Source§

fn haversine_intermediate(&self, other: &Point<T>, ratio: T) -> Point<T>

👎Deprecated since 0.29.0: Please use Haversine::point_at_ratio_between from the InterpolatePoint trait instead
Returns a new Point along a great circle route between self and other. Read more
Source§

fn haversine_intermediate_fill( &self, other: &Point<T>, max_dist: T, include_ends: bool, ) -> Vec<Point<T>>

👎Deprecated since 0.29.0: Please use Haversine::points_along_line from the InterpolatePoint trait instead
Interpolates Points along a great circle route between self and other. Read more
Source§

impl<T> InteriorPoint for Point<T>
where T: GeoFloat,

Source§

type Output = Point<T>

Source§

fn interior_point(&self) -> Self::Output

Calculates a representative point inside the Geometry Read more
Source§

impl<T, G> Intersects<G> for Point<T>
where T: CoordNum, Coord<T>: Intersects<G>,

Source§

fn intersects(&self, rhs: &G) -> bool

Source§

impl<T> Intersects<MultiLineString<T>> for Point<T>

Source§

fn intersects(&self, rhs: &MultiLineString<T>) -> bool

Source§

impl<T> Intersects<MultiPolygon<T>> for Point<T>

Source§

fn intersects(&self, rhs: &MultiPolygon<T>) -> bool

Source§

impl<T> Intersects<Point<T>> for Coord<T>
where T: CoordNum,

Source§

fn intersects(&self, rhs: &Point<T>) -> bool

Source§

impl<T> Intersects<Point<T>> for Line<T>
where Point<T>: Intersects<Line<T>>, T: CoordNum,

Source§

fn intersects(&self, rhs: &Point<T>) -> bool

Source§

impl<T> Intersects<Point<T>> for Polygon<T>
where Point<T>: Intersects<Polygon<T>>, T: CoordNum,

Source§

fn intersects(&self, rhs: &Point<T>) -> bool

Source§

impl<T> Intersects<Point<T>> for Rect<T>
where Point<T>: Intersects<Rect<T>>, T: CoordNum,

Source§

fn intersects(&self, rhs: &Point<T>) -> bool

Source§

impl<T> Intersects<Point<T>> for Triangle<T>
where Point<T>: Intersects<Triangle<T>>, T: CoordNum,

Source§

fn intersects(&self, rhs: &Point<T>) -> bool

Source§

impl<T> LineLocatePoint<T, Point<T>> for Line<T>
where T: CoordFloat,

Source§

type Output = Option<T>

Source§

type Rhs = Point<T>

Source§

fn line_locate_point(&self, p: &Self::Rhs) -> Self::Output

Source§

impl<T> LineLocatePoint<T, Point<T>> for LineString<T>

Source§

type Output = Option<T>

Source§

type Rhs = Point<T>

Source§

fn line_locate_point(&self, p: &Self::Rhs) -> Self::Output

Source§

impl<T: CoordNum, NT: CoordNum> MapCoords<T, NT> for Point<T>

Source§

type Output = Point<NT>

Source§

fn map_coords( &self, func: impl Fn(Coord<T>) -> Coord<NT> + Copy, ) -> Self::Output

Apply a function to all the coordinates in a geometric object, returning a new object. Read more
Source§

fn try_map_coords<E>( &self, func: impl Fn(Coord<T>) -> Result<Coord<NT>, E>, ) -> Result<Self::Output, E>

Map a fallible function over all the coordinates in a geometry, returning a Result Read more
Source§

impl<T: CoordNum> MapCoordsInPlace<T> for Point<T>

Source§

fn map_coords_in_place(&mut self, func: impl Fn(Coord<T>) -> Coord<T>)

Apply a function to all the coordinates in a geometric object, in place Read more
Source§

fn try_map_coords_in_place<E>( &mut self, func: impl Fn(Coord<T>) -> Result<Coord<T>, E>, ) -> Result<(), E>

Map a fallible function over all the coordinates in a geometry, in place, returning a Result. Read more
Source§

impl<T> Mul<T> for Point<T>
where T: CoordNum,

Source§

fn mul(self, rhs: T) -> <Point<T> as Mul<T>>::Output

Scaler multiplication of a point

§Examples
use geo_types::Point;

let p = Point::new(2.0, 3.0) * 2.0;

assert_eq!(p.x(), 4.0);
assert_eq!(p.y(), 6.0);
Source§

type Output = Point<T>

The resulting type after applying the * operator.
Source§

impl<T> MulAssign<T> for Point<T>
where T: CoordNum,

Source§

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> Neg for Point<T>
where T: CoordNum + Neg<Output = T>,

Source§

fn neg(self) -> <Point<T> as Neg>::Output

Returns a point with the x and y components negated.

§Examples
use geo_types::Point;

let p = -Point::new(-1.25, 2.5);

assert_eq!(p.x(), 1.25);
assert_eq!(p.y(), -2.5);
Source§

type Output = Point<T>

The resulting type after applying the - operator.
Source§

impl<T> PartialEq for Point<T>
where T: PartialEq + CoordNum,

Source§

fn eq(&self, other: &Point<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Point for Point<T>
where T: Float + RTreeNum,

Source§

const DIMENSIONS: usize = 2usize

The number of dimensions of this point type.
Source§

type Scalar = T

The number type used by this point type.
Source§

fn generate( generator: impl FnMut(usize) -> <Point<T> as Point>::Scalar, ) -> Point<T>

Creates a new point value with given values for each dimension. Read more
Source§

fn nth(&self, index: usize) -> <Point<T> as Point>::Scalar

Returns a single coordinate of this point. Read more
Source§

fn nth_mut(&mut self, index: usize) -> &mut <Point<T> as Point>::Scalar

Mutable variant of nth.
Source§

impl<F: GeoFloat> Relate<F> for Point<F>

Source§

fn geometry_graph(&self, arg_index: usize) -> GeometryGraph<'_, F>

Construct a GeometryGraph
Source§

fn relate(&self, other: &impl Relate<F>) -> IntersectionMatrix

Source§

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

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

The default relative tolerance for testing values that are far-apart. Read more
Source§

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

The inverse of RelativeEq::relative_eq.
Source§

impl<T> RemoveRepeatedPoints<T> for Point<T>

Source§

fn remove_repeated_points(&self) -> Self

Create a new geometry with (consecutive) repeated points removed.
Source§

fn remove_repeated_points_mut(&mut self)

Remove (consecutive) repeated points inplace.
Source§

impl<T> RhumbBearing<T> for Point<T>

Source§

fn rhumb_bearing(&self, point: Point<T>) -> T

👎Deprecated since 0.29.0: Please use the Rhumb::bearing method from the Bearing trait instead
Returns the bearing to another Point in degrees along a rhumb line, where North is 0° and East is 90°. Read more
Source§

impl<T> RhumbDestination<T> for Point<T>

Source§

fn rhumb_destination(&self, bearing: T, distance: T) -> Point<T>

👎Deprecated since 0.29.0: Please use the Rhumb::destination method from the Destination trait instead
Returns the destination Point having travelled the given distance along a rhumb line from the origin Point with the given bearing Read more
Source§

impl<T> RhumbDistance<T> for Point<T>

Source§

fn rhumb_distance(&self, rhs: &Point<T>) -> T

👎Deprecated since 0.29.0: Please use the Rhumb::distance method from the Distance trait instead
Determine the distance between along the rhumb line between two geometries. Read more
Source§

impl<T> RhumbIntermediate<T> for Point<T>

Source§

fn rhumb_intermediate(&self, other: &Point<T>, f: T) -> Point<T>

👎Deprecated since 0.29.0: Please use Rhumb::point_at_ratio_between from the InterpolatePoint trait instead
Returns a new Point along a rhumb line between two existing points. Read more
Source§

fn rhumb_intermediate_fill( &self, other: &Point<T>, max_dist: T, include_ends: bool, ) -> Vec<Point<T>>

👎Deprecated since 0.29.0: Please use Rhumb::points_along_line from the InterpolatePoint trait instead
Source§

impl<T> Sub for Point<T>
where T: CoordNum,

Source§

fn sub(self, rhs: Point<T>) -> <Point<T> as Sub>::Output

Subtract a point from the given point.

§Examples
use geo_types::Point;

let p = Point::new(1.25, 3.0) - Point::new(1.5, 2.5);

assert_eq!(p.x(), -0.25);
assert_eq!(p.y(), 0.5);
Source§

type Output = Point<T>

The resulting type after applying the - operator.
Source§

impl<T> SubAssign for Point<T>
where T: CoordNum,

Source§

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,

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§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from( geom: Geometry<T>, ) -> Result<Point<T>, <Point<T> as TryFrom<Geometry<T>>>::Error>

Performs the conversion.
Source§

impl<T> VincentyDistance<T> for Point<T>

Source§

fn vincenty_distance(&self, rhs: &Point<T>) -> Result<T, FailedToConvergeError>

Determine the distance between two geometries using Vincenty’s formulae. Read more
Source§

impl<T> Copy for Point<T>
where T: Copy + CoordNum,

Source§

impl<T> Eq for Point<T>
where T: Eq + CoordNum,

Source§

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
where T: CoordNum, M: MapCoordsInPlace<T> + MapCoords<T, T, Output = M>,

Source§

fn affine_transform(&self, transform: &AffineTransform<T>) -> M

Apply transform immutably, outputting a new geometry.
Source§

fn affine_transform_mut(&mut self, transform: &AffineTransform<T>)

Apply transform to mutate self.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<G, T, U> Convert<T, U> for G
where T: CoordNum, U: CoordNum + From<T>, G: MapCoords<T, U>,

Source§

type Output = <G as MapCoords<T, U>>::Output

Source§

fn convert(&self) -> <G as Convert<T, U>>::Output

Source§

impl<'a, T, G> ConvexHull<'a, T> for G
where T: GeoNum, G: CoordsIter<Scalar = T>,

Source§

type Scalar = T

Source§

fn convex_hull(&'a self) -> Polygon<T>

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<'a, T, G> Extremes<'a, T> for G
where G: CoordsIter<Scalar = T>, T: CoordNum,

Source§

fn extremes(&'a self) -> Option<Outcome<T>>

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, G> HausdorffDistance<T> for G
where T: GeoFloat, G: CoordsIter<Scalar = T>,

Source§

fn hausdorff_distance<Rhs>(&self, rhs: &Rhs) -> T
where Rhs: CoordsIter<Scalar = T>,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T, G> MinimumRotatedRect<T> for G
where T: CoordFloat + GeoFloat + GeoNum, G: CoordsIter<Scalar = T>,

Source§

impl<P> PointDistance for P
where P: Point,

Source§

fn distance_2(&self, point: &P) -> <P as Point>::Scalar

Returns the squared distance between an object and a point. Read more
Source§

fn contains_point( &self, point: &<<P as RTreeObject>::Envelope as Envelope>::Point, ) -> bool

Returns true if a point is contained within this object. Read more
Source§

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>

Returns the squared distance to this object, or None if the distance is larger than a given maximum value. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P> RTreeObject for P
where P: Point,

Source§

type Envelope = AABB<P>

The object’s envelope type. Usually, AABB will be the right choice. This type also defines the object’s dimensionality.
Source§

fn envelope(&self) -> AABB<P>

Returns the object’s envelope. Read more
Source§

impl<G, IP, IR, T> Rotate<T> for G
where T: CoordFloat, IP: Into<Option<Point<T>>>, IR: Into<Option<Rect<T>>>, G: Clone + Centroid<Output = IP> + BoundingRect<T, Output = IR> + AffineOps<T>,

Source§

fn rotate_around_centroid(&self, degrees: T) -> G

Rotate a geometry around its centroid by an angle, in degrees Read more
Source§

fn rotate_around_centroid_mut(&mut self, degrees: T)

Mutable version of Self::rotate_around_centroid
Source§

fn rotate_around_center(&self, degrees: T) -> G

Rotate a geometry around the center of its bounding box by an angle, in degrees. Read more
Source§

fn rotate_around_center_mut(&mut self, degrees: T)

Mutable version of Self::rotate_around_center
Source§

fn rotate_around_point(&self, degrees: T, point: Point<T>) -> G

Rotate a Geometry around an arbitrary point by an angle, given in degrees Read more
Source§

fn rotate_around_point_mut(&mut self, degrees: T, point: Point<T>)

Mutable version of Self::rotate_around_point
Source§

impl<T, IR, G> Scale<T> for G
where T: CoordFloat, IR: Into<Option<Rect<T>>>, G: Clone + AffineOps<T> + BoundingRect<T, Output = IR>,

Source§

fn scale(&self, scale_factor: T) -> G

Scale a geometry from it’s bounding box center. Read more
Source§

fn scale_mut(&mut self, scale_factor: T)

Mutable version of scale
Source§

fn scale_xy(&self, x_factor: T, y_factor: T) -> G

Scale a geometry from it’s bounding box center, using different values for x_factor and y_factor to distort the geometry’s aspect ratio. Read more
Source§

fn scale_xy_mut(&mut self, x_factor: T, y_factor: T)

Mutable version of scale_xy.
Source§

fn scale_around_point( &self, x_factor: T, y_factor: T, origin: impl Into<Coord<T>>, ) -> G

Scale a geometry around a point of origin. Read more
Source§

fn scale_around_point_mut( &mut self, x_factor: T, y_factor: T, origin: impl Into<Coord<T>>, )

Mutable version of scale_around_point.
Source§

impl<T, IR, G> Skew<T> for G
where T: CoordFloat, IR: Into<Option<Rect<T>>>, G: Clone + AffineOps<T> + BoundingRect<T, Output = IR>,

Source§

fn skew(&self, degrees: T) -> G

An affine transformation which skews a geometry, sheared by a uniform angle along the x and y dimensions. Read more
Source§

fn skew_mut(&mut self, degrees: T)

Mutable version of skew.
Source§

fn skew_xy(&self, degrees_x: T, degrees_y: T) -> G

An affine transformation which skews a geometry, sheared by an angle along the x and y dimensions. Read more
Source§

fn skew_xy_mut(&mut self, degrees_x: T, degrees_y: T)

Mutable version of skew_xy.
Source§

fn skew_around_point(&self, xs: T, ys: T, origin: impl Into<Coord<T>>) -> G

An affine transformation which skews a geometry around a point of origin, sheared by an angle along the x and y dimensions. Read more
Source§

fn skew_around_point_mut(&mut self, xs: T, ys: T, origin: impl Into<Coord<T>>)

Mutable version of skew_around_point.
Source§

impl<T, G> ToDegrees<T> for G
where T: CoordFloat, G: MapCoords<T, T, Output = G> + MapCoordsInPlace<T>,

Source§

fn to_degrees(&self) -> Self

Source§

fn to_degrees_in_place(&mut self)

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, G> ToRadians<T> for G
where T: CoordFloat, G: MapCoords<T, T, Output = G> + MapCoordsInPlace<T>,

Source§

fn to_radians(&self) -> Self

Source§

fn to_radians_in_place(&mut self)

Source§

impl<T, G> Translate<T> for G
where T: CoordNum, G: AffineOps<T>,

Source§

fn translate(&self, x_offset: T, y_offset: T) -> G

Translate a Geometry along its axes by the given offsets Read more
Source§

fn translate_mut(&mut self, x_offset: T, y_offset: T)

Translate a Geometry along its axes, but in place.
Source§

impl<G, T, U> TryConvert<T, U> for G
where T: CoordNum, U: CoordNum + TryFrom<T>, G: MapCoords<T, U>,

Source§

type Output = Result<<G as MapCoords<T, U>>::Output, <U as TryFrom<T>>::Error>

Source§

fn try_convert(&self) -> <G as TryConvert<T, U>>::Output

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool