Struct geo::geometry::Rect

source ·
pub struct Rect<T = f64>
where T: CoordNum,
{ /* private fields */ }
Expand description

An axis-aligned bounded 2D rectangle whose area is defined by minimum and maximum Coords.

The constructors and setters ensure the maximum Coord is greater than or equal to the minimum. Thus, a Rects width, height, and area is guaranteed to be greater than or equal to zero.

Note. While Rect implements MapCoords and RotatePoint algorithmic traits, the usage is expected to maintain the axis alignment. In particular, only rotation by integer multiples of 90 degrees, will preserve the original shape. In other cases, the min, and max points are rotated or transformed, and a new rectangle is created (with coordinate swaps to ensure min < max).

§Examples

use geo_types::{coord, Rect};

let rect = Rect::new(
    coord! { x: 0., y: 4.},
    coord! { x: 3., y: 10.},
);

assert_eq!(3., rect.width());
assert_eq!(6., rect.height());
assert_eq!(
    coord! { x: 1.5, y: 7. },
    rect.center()
);

Implementations§

source§

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

source

pub fn new<C>(c1: C, c2: C) -> Rect<T>
where C: Into<Coord<T>>,

Creates a new rectangle from two corner coordinates.

§Examples
use geo_types::{coord, Rect};

let rect = Rect::new(
    coord! { x: 10., y: 20. },
    coord! { x: 30., y: 10. }
);
assert_eq!(rect.min(), coord! { x: 10., y: 10. });
assert_eq!(rect.max(), coord! { x: 30., y: 20. });
source

pub fn try_new<C>(c1: C, c2: C) -> Result<Rect<T>, InvalidRectCoordinatesError>
where C: Into<Coord<T>>,

👎Deprecated since 0.6.2: Use Rect::new instead, since Rect::try_new will never Error
source

pub fn min(self) -> Coord<T>

Returns the minimum Coord of the Rect.

§Examples
use geo_types::{coord, Rect};

let rect = Rect::new(
    coord! { x: 5., y: 5. },
    coord! { x: 15., y: 15. },
);

assert_eq!(rect.min(), coord! { x: 5., y: 5. });
source

pub fn set_min<C>(&mut self, min: C)
where C: Into<Coord<T>>,

Set the Rect’s minimum coordinate.

§Panics

Panics if min’s x/y is greater than the maximum coordinate’s x/y.

source

pub fn max(self) -> Coord<T>

Returns the maximum Coord of the Rect.

§Examples
use geo_types::{coord, Rect};

let rect = Rect::new(
    coord! { x: 5., y: 5. },
    coord! { x: 15., y: 15. },
);

assert_eq!(rect.max(), coord! { x: 15., y: 15. });
source

pub fn set_max<C>(&mut self, max: C)
where C: Into<Coord<T>>,

Set the Rect’s maximum coordinate.

§Panics

Panics if max’s x/y is less than the minimum coordinate’s x/y.

source

pub fn width(self) -> T

Returns the width of the Rect.

§Examples
use geo_types::{coord, Rect};

let rect = Rect::new(
    coord! { x: 5., y: 5. },
    coord! { x: 15., y: 15. },
);

assert_eq!(rect.width(), 10.);
source

pub fn height(self) -> T

Returns the height of the Rect.

§Examples
use geo_types::{coord, Rect};

let rect = Rect::new(
    coord! { x: 5., y: 5. },
    coord! { x: 15., y: 15. },
);

assert_eq!(rect.height(), 10.);
source

pub fn to_polygon(self) -> Polygon<T>

Create a Polygon from the Rect.

§Examples
use geo_types::{coord, Rect, polygon};

let rect = Rect::new(
    coord! { x: 0., y: 0. },
    coord! { x: 1., y: 2. },
);

assert_eq!(
    rect.to_polygon(),
    polygon![
        (x: 0., y: 0.),
        (x: 0., y: 2.),
        (x: 1., y: 2.),
        (x: 1., y: 0.),
        (x: 0., y: 0.),
    ],
);
source

pub fn to_lines(&self) -> [Line<T>; 4]

source

pub fn split_x(self) -> [Rect<T>; 2]

Split a rectangle into two rectangles along the X-axis with equal widths.

§Examples
let rect = geo_types::Rect::new(
    geo_types::coord! { x: 0., y: 0. },
    geo_types::coord! { x: 4., y: 4. },
);

let [rect1, rect2] = rect.split_x();

assert_eq!(
    geo_types::Rect::new(
        geo_types::coord! { x: 0., y: 0. },
        geo_types::coord! { x: 2., y: 4. },
    ),
    rect1,
);
assert_eq!(
    geo_types::Rect::new(
        geo_types::coord! { x: 2., y: 0. },
        geo_types::coord! { x: 4., y: 4. },
    ),
    rect2,
);
source

pub fn split_y(self) -> [Rect<T>; 2]

Split a rectangle into two rectangles along the Y-axis with equal heights.

§Examples
let rect = geo_types::Rect::new(
    geo_types::coord! { x: 0., y: 0. },
    geo_types::coord! { x: 4., y: 4. },
);

let [rect1, rect2] = rect.split_y();

assert_eq!(
    geo_types::Rect::new(
        geo_types::coord! { x: 0., y: 0. },
        geo_types::coord! { x: 4., y: 2. },
    ),
    rect1,
);
assert_eq!(
    geo_types::Rect::new(
        geo_types::coord! { x: 0., y: 2. },
        geo_types::coord! { x: 4., y: 4. },
    ),
    rect2,
);
source§

impl<T> Rect<T>
where T: CoordFloat,

source

pub fn center(self) -> Coord<T>

Returns the center Coord of the Rect.

§Examples
use geo_types::{coord, Rect};

let rect = Rect::new(
    coord! { x: 5., y: 5. },
    coord! { x: 15., y: 15. },
);

assert_eq!(rect.center(), coord! { x: 10., y: 10. });

Trait Implementations§

source§

impl<T> AbsDiffEq for Rect<T>
where T: AbsDiffEq<Epsilon = T> + CoordNum, <T as AbsDiffEq>::Epsilon: Copy,

source§

fn abs_diff_eq( &self, other: &Rect<T>, epsilon: <Rect<T> as AbsDiffEq>::Epsilon ) -> bool

Equality assertion with an absolute limit.

§Examples
use geo_types::{point, Rect};

let a = Rect::new((0.0, 0.0), (10.0, 10.0));
let b = Rect::new((0.0, 0.0), (10.01, 10.0));

approx::abs_diff_eq!(a, b, epsilon=0.1);
approx::abs_diff_ne!(a, b, epsilon=0.001);
§

type Epsilon = T

Used for specifying relative comparisons.
source§

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

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

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

The inverse of [AbsDiffEq::abs_diff_eq].
source§

impl<T> Area<T> for Rect<T>
where T: CoordNum,

Because a Rect has no winding order, the area will always be positive.

source§

fn signed_area(&self) -> T

source§

fn unsigned_area(&self) -> T

source§

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

§

type Output = Rect<T>

source§

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

Return the bounding rectangle of a geometry Read more
source§

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

source§

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

The Centroid of a Rect is the mean of its Points

§Examples
use geo::Centroid;
use geo::{Rect, point};

let rect = Rect::new(
  point!(x: 0.0f32, y: 0.0),
  point!(x: 1.0, y: 1.0),
);

assert_eq!(
    point!(x: 0.5, y: 0.5),
    rect.centroid(),
);
§

type Output = Point<T>

source§

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

source§

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

source§

fn clone(&self) -> Rect<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 Rect<F>

source§

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

Find the closest point between self and p.
source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

impl<T> Contains<Line<T>> for Rect<T>
where T: GeoFloat,

source§

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

source§

impl<T> Contains<LineString<T>> for Rect<T>
where T: GeoFloat,

source§

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

source§

impl<T> Contains<MultiLineString<T>> for Rect<T>
where T: GeoFloat,

source§

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

source§

impl<T> Contains<MultiPoint<T>> for Rect<T>
where T: GeoFloat,

source§

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

source§

impl<T> Contains<MultiPolygon<T>> for Rect<T>
where T: GeoFloat,

source§

fn contains(&self, target: &MultiPolygon<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<Polygon<T>> for Rect<T>
where T: GeoFloat,

source§

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

source§

impl<F> Contains<Rect<F>> for MultiPolygon<F>
where F: GeoFloat,

source§

fn contains(&self, rhs: &Rect<F>) -> bool

source§

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

source§

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

source§

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

source§

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

source§

impl<T> Contains<Rect<T>> for Line<T>
where T: GeoFloat,

source§

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

source§

impl<T> Contains<Rect<T>> for LineString<T>
where T: GeoFloat,

source§

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

source§

impl<T> Contains<Rect<T>> for MultiLineString<T>
where T: GeoFloat,

source§

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

source§

impl<T> Contains<Rect<T>> for MultiPoint<T>
where T: GeoFloat,

source§

fn contains(&self, target: &Rect<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<Rect<T>> for Polygon<T>
where T: GeoFloat,

source§

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

source§

impl<T> Contains<Rect<T>> for Triangle<T>
where T: GeoFloat,

source§

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

source§

impl<T> Contains<Triangle<T>> for Rect<T>
where T: GeoFloat,

source§

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

source§

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

source§

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

source§

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

§

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 Rect<T>

source§

fn coords_count(&self) -> usize

Return the number of coordinates in the Rect.

Note: Although a Rect is represented by two coordinates, it is spatially represented by four, so this method returns 4.

§

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

§

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

§

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> Debug for Rect<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> Densify<T> for Rect<T>

§

type Output = Polygon<T>

source§

fn densify(&self, max_distance: T) -> Self::Output

source§

impl<T> DensifyHaversine<T> for Rect<T>

§

type Output = Polygon<T>

source§

fn densify_haversine(&self, max_distance: T) -> Self::Output

source§

impl<T> EuclideanDistance<T> for Rect<T>

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Returns the distance between two geometries Read more
source§

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

source§

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

Converts to this type from the input type.
source§

impl<T> From<Rect<T>> for Polygon<T>
where T: CoordNum,

source§

fn from(r: Rect<T>) -> Polygon<T>

Converts to this type from the input type.
source§

impl GeodesicArea<f64> for Rect

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<C: CoordNum> HasDimensions for Rect<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 Rect<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> HaversineClosestPoint<T> for Rect<T>

source§

fn haversine_closest_point(&self, from: &Point<T>) -> Closest<T>

source§

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

§

type Output = Point<T>

source§

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

Calculates a representative point inside the Geometry Read more
source§

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

source§

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

source§

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

source§

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

source§

impl<T> Intersects<GeometryCollection<T>> for Rect<T>

source§

impl<T> Intersects<Line<T>> for Rect<T>
where T: GeoNum,

source§

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

source§

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

source§

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

source§

impl<T> Intersects<MultiLineString<T>> for Rect<T>

source§

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

source§

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

source§

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

source§

impl<T> Intersects<MultiPolygon<T>> for Rect<T>

source§

fn intersects(&self, rhs: &MultiPolygon<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<Polygon<T>> for Rect<T>
where Polygon<T>: Intersects<Rect<T>>, T: CoordNum,

source§

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

source§

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

source§

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

source§

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

source§

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

source§

impl<T> Intersects<Rect<T>> for Polygon<T>
where T: GeoNum,

source§

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

source§

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

source§

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

source§

impl<T> Intersects<Triangle<T>> for Rect<T>
where T: GeoNum,

source§

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

source§

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

source§

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

source§

impl<'a, T: CoordNum + 'a> LinesIter<'a> for Rect<T>

§

type Scalar = T

§

type Iter = <[Line<<Rect<T> as LinesIter<'a>>::Scalar>; 4] as IntoIterator>::IntoIter

source§

fn lines_iter(&'a self) -> Self::Iter

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

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

§

type Output = Rect<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 Rect<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> PartialEq for Rect<T>
where T: PartialEq + CoordNum,

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for Rect<F>

source§

impl<F: GeoFloat> Relate<F, Line<F>> for Rect<F>

source§

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

source§

impl<F: GeoFloat> Relate<F, LineString<F>> for Rect<F>

source§

impl<F: GeoFloat> Relate<F, MultiLineString<F>> for Rect<F>

source§

impl<F: GeoFloat> Relate<F, MultiPoint<F>> for Rect<F>

source§

impl<F: GeoFloat> Relate<F, MultiPolygon<F>> for Rect<F>

source§

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

source§

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

source§

impl<F: GeoFloat> Relate<F, Polygon<F>> for Rect<F>

source§

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

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for GeometryCollection<F>

source§

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

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for Line<F>

source§

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

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for LineString<F>

source§

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

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for MultiLineString<F>

source§

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

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for MultiPoint<F>

source§

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

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for MultiPolygon<F>

source§

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

source§

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

source§

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

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for Polygon<F>

source§

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

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for Rect<F>

source§

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

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for Triangle<F>

source§

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

source§

impl<F: GeoFloat> Relate<F, Triangle<F>> for Rect<F>

source§

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

source§

impl<T> RelativeEq for Rect<T>
where T: AbsDiffEq<Epsilon = T> + CoordNum + RelativeEq,

source§

fn relative_eq( &self, other: &Rect<T>, epsilon: <Rect<T> as AbsDiffEq>::Epsilon, max_relative: <Rect<T> as AbsDiffEq>::Epsilon ) -> bool

Equality assertion within a relative limit.

§Examples
use geo_types::Rect;

let a = Rect::new((0.0, 0.0), (10.0, 10.0));
let b = Rect::new((0.0, 0.0), (10.01, 10.0));

approx::assert_relative_eq!(a, b, max_relative=0.1);
approx::assert_relative_ne!(a, b, max_relative=0.0001);
source§

fn default_max_relative() -> <Rect<T> as AbsDiffEq>::Epsilon

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

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 Rect<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> TryFrom<Geometry<T>> for Rect<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.

§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

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

source§

impl<T> StructuralPartialEq for Rect<T>
where T: CoordNum,

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Rect<T>
where T: RefUnwindSafe,

§

impl<T> Send for Rect<T>
where T: Send,

§

impl<T> Sync for Rect<T>
where T: Sync,

§

impl<T> Unpin for Rect<T>
where T: Unpin,

§

impl<T> UnwindSafe for Rect<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<G, T, U> Convert<T, U> for G
where T: CoordNum, U: CoordNum + From<T>, G: MapCoords<T, U>,

§

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

§

type Scalar = T

source§

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

§

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

§

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, G> MinimumRotatedRect<T> for G
where T: CoordFloat + GeoFloat + GeoNum, G: CoordsIter<Scalar = T>,

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,

§

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<'a, T, G> TriangulateSpade<'a, T> for G
where T: SpadeTriangulationFloat, G: TriangulationRequirementTrait<'a, T>,

source§

fn unconstrained_triangulation(&'a self) -> TriangulationResult<Triangles<T>>

returns a triangulation that’s solely based on the points of the geometric object Read more
source§

fn constrained_outer_triangulation( &'a self, config: SpadeTriangulationConfig<T> ) -> TriangulationResult<Triangles<T>>

returns triangulation that’s based on the points of the geometric object and also incorporates the lines of the input geometry Read more
source§

fn constrained_triangulation( &'a self, config: SpadeTriangulationConfig<T> ) -> TriangulationResult<Triangles<T>>

returns triangulation that’s based on the points of the geometric object and also incorporates the lines of the input geometry Read more
source§

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

§

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

§

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

§

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