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 Coord
s.
The constructors and setters ensure the maximum
Coord
is greater than or equal to the minimum.
Thus, a Rect
s 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,
impl<T> Rect<T>where
T: CoordNum,
Sourcepub fn new<C>(c1: C, c2: C) -> Rect<T>
pub fn new<C>(c1: C, c2: C) -> Rect<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. });
pub fn try_new<C>(c1: C, c2: C) -> Result<Rect<T>, InvalidRectCoordinatesError>
Rect::new
instead, since Rect::try_new
will never ErrorSourcepub fn min(self) -> Coord<T>
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. });
Sourcepub fn set_min<C>(&mut self, min: C)
pub fn set_min<C>(&mut self, min: C)
Set the Rect
’s minimum coordinate.
§Panics
Panics if min
’s x/y is greater than the maximum coordinate’s x/y.
Sourcepub fn max(self) -> Coord<T>
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. });
Sourcepub fn set_max<C>(&mut self, max: C)
pub fn set_max<C>(&mut self, max: C)
Set the Rect
’s maximum coordinate.
§Panics
Panics if max
’s x/y is less than the minimum coordinate’s x/y.
Sourcepub fn width(self) -> T
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.);
Sourcepub fn height(self) -> T
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.);
Sourcepub fn to_polygon(self) -> Polygon<T>
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.),
],
);
pub fn to_lines(&self) -> [Line<T>; 4]
Sourcepub fn split_x(self) -> [Rect<T>; 2]
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,
);
Sourcepub fn split_y(self) -> [Rect<T>; 2]
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,
);
Trait Implementations§
Source§impl<T> AbsDiffEq for Rect<T>
impl<T> AbsDiffEq for Rect<T>
Source§fn abs_diff_eq(
&self,
other: &Rect<T>,
epsilon: <Rect<T> as AbsDiffEq>::Epsilon,
) -> bool
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);
Source§fn default_epsilon() -> <Rect<T> as AbsDiffEq>::Epsilon
fn default_epsilon() -> <Rect<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> Area<T> for Rect<T>where
T: CoordNum,
impl<T> Area<T> for Rect<T>where
T: CoordNum,
Because a Rect
has no winding order, the area will always be positive.
fn signed_area(&self) -> T
fn unsigned_area(&self) -> T
Source§impl<T> BoundingRect<T> for Rect<T>where
T: CoordNum,
impl<T> BoundingRect<T> for Rect<T>where
T: CoordNum,
Source§impl<T> Centroid for Rect<T>where
T: GeoFloat,
impl<T> Centroid for Rect<T>where
T: GeoFloat,
Source§impl<T> ChamberlainDuquetteArea<T> for Rect<T>where
T: CoordFloat,
impl<T> ChamberlainDuquetteArea<T> for Rect<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 Rect<F>
impl<F: GeoFloat> ClosestPoint<F> for Rect<F>
Source§fn closest_point(&self, p: &Point<F>) -> Closest<F>
fn closest_point(&self, p: &Point<F>) -> Closest<F>
self
and p
.Source§impl<T> Contains<GeometryCollection<T>> for Rect<T>where
T: GeoFloat,
impl<T> Contains<GeometryCollection<T>> for Rect<T>where
T: GeoFloat,
fn contains(&self, target: &GeometryCollection<T>) -> bool
Source§impl<T> Contains<LineString<T>> for Rect<T>where
T: GeoFloat,
impl<T> Contains<LineString<T>> for Rect<T>where
T: GeoFloat,
fn contains(&self, target: &LineString<T>) -> bool
Source§impl<T> Contains<MultiLineString<T>> for Rect<T>where
T: GeoFloat,
impl<T> Contains<MultiLineString<T>> for Rect<T>where
T: GeoFloat,
fn contains(&self, target: &MultiLineString<T>) -> bool
Source§impl<T> Contains<MultiPoint<T>> for Rect<T>where
T: GeoFloat,
impl<T> Contains<MultiPoint<T>> for Rect<T>where
T: GeoFloat,
fn contains(&self, target: &MultiPoint<T>) -> bool
Source§impl<T> Contains<MultiPolygon<T>> for Rect<T>where
T: GeoFloat,
impl<T> Contains<MultiPolygon<T>> for Rect<T>where
T: GeoFloat,
fn contains(&self, target: &MultiPolygon<T>) -> bool
Source§impl<T> CoordinatePosition for Rect<T>where
T: GeoNum,
impl<T> CoordinatePosition for Rect<T>where
T: GeoNum,
Source§impl<T: CoordNum> CoordsIter for Rect<T>
impl<T: CoordNum> CoordsIter for Rect<T>
Source§fn coords_count(&self) -> usize
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<'_>
fn coords_iter(&self) -> Self::Iter<'_>
Source§fn exterior_coords_iter(&self) -> Self::ExteriorIter<'_>
fn exterior_coords_iter(&self) -> Self::ExteriorIter<'_>
Source§impl<F: CoordFloat + FromPrimitive> Densify<F> for Rect<F>
impl<F: CoordFloat + FromPrimitive> Densify<F> for Rect<F>
Source§impl<T> DensifyHaversine<T> for Rect<T>where
T: CoordFloat + FromPrimitive,
Line<T>: HaversineLength<T>,
LineString<T>: HaversineLength<T>,
impl<T> DensifyHaversine<T> for Rect<T>where
T: CoordFloat + FromPrimitive,
Line<T>: HaversineLength<T>,
LineString<T>: HaversineLength<T>,
Source§impl<F: GeoFloat> Distance<F, &GeometryCollection<F>, &Rect<F>> for Euclidean
impl<F: GeoFloat> Distance<F, &GeometryCollection<F>, &Rect<F>> for Euclidean
Source§fn distance(iter_geometry: &GeometryCollection<F>, to_geometry: &Rect<F>) -> F
fn distance(iter_geometry: &GeometryCollection<F>, to_geometry: &Rect<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F> Distance<F, &LineString<F>, &Rect<F>> for Euclideanwhere
F: GeoFloat,
impl<F> Distance<F, &LineString<F>, &Rect<F>> for Euclideanwhere
F: GeoFloat,
Source§fn distance(a: &LineString<F>, b: &Rect<F>) -> F
fn distance(a: &LineString<F>, b: &Rect<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F: GeoFloat> Distance<F, &MultiLineString<F>, &Rect<F>> for Euclidean
impl<F: GeoFloat> Distance<F, &MultiLineString<F>, &Rect<F>> for Euclidean
Source§fn distance(iter_geometry: &MultiLineString<F>, to_geometry: &Rect<F>) -> F
fn distance(iter_geometry: &MultiLineString<F>, to_geometry: &Rect<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F: GeoFloat> Distance<F, &MultiPoint<F>, &Rect<F>> for Euclidean
impl<F: GeoFloat> Distance<F, &MultiPoint<F>, &Rect<F>> for Euclidean
Source§fn distance(iter_geometry: &MultiPoint<F>, to_geometry: &Rect<F>) -> F
fn distance(iter_geometry: &MultiPoint<F>, to_geometry: &Rect<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F: GeoFloat> Distance<F, &MultiPolygon<F>, &Rect<F>> for Euclidean
impl<F: GeoFloat> Distance<F, &MultiPolygon<F>, &Rect<F>> for Euclidean
Source§fn distance(iter_geometry: &MultiPolygon<F>, to_geometry: &Rect<F>) -> F
fn distance(iter_geometry: &MultiPolygon<F>, to_geometry: &Rect<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F> Distance<F, &Rect<F>, &GeometryCollection<F>> for Euclideanwhere
F: GeoFloat,
impl<F> Distance<F, &Rect<F>, &GeometryCollection<F>> for Euclideanwhere
F: GeoFloat,
Source§fn distance(a: &Rect<F>, b: &GeometryCollection<F>) -> F
fn distance(a: &Rect<F>, b: &GeometryCollection<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F: GeoFloat> Distance<F, &Rect<F>, &LineString<F>> for Euclidean
impl<F: GeoFloat> Distance<F, &Rect<F>, &LineString<F>> for Euclidean
Source§fn distance(polygonlike: &Rect<F>, geometry_b: &LineString<F>) -> F
fn distance(polygonlike: &Rect<F>, geometry_b: &LineString<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F> Distance<F, &Rect<F>, &MultiLineString<F>> for Euclideanwhere
F: GeoFloat,
impl<F> Distance<F, &Rect<F>, &MultiLineString<F>> for Euclideanwhere
F: GeoFloat,
Source§fn distance(a: &Rect<F>, b: &MultiLineString<F>) -> F
fn distance(a: &Rect<F>, b: &MultiLineString<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F> Distance<F, &Rect<F>, &MultiPoint<F>> for Euclideanwhere
F: GeoFloat,
impl<F> Distance<F, &Rect<F>, &MultiPoint<F>> for Euclideanwhere
F: GeoFloat,
Source§fn distance(a: &Rect<F>, b: &MultiPoint<F>) -> F
fn distance(a: &Rect<F>, b: &MultiPoint<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<F> Distance<F, &Rect<F>, &MultiPolygon<F>> for Euclideanwhere
F: GeoFloat,
impl<F> Distance<F, &Rect<F>, &MultiPolygon<F>> for Euclideanwhere
F: GeoFloat,
Source§fn distance(a: &Rect<F>, b: &MultiPolygon<F>) -> F
fn distance(a: &Rect<F>, b: &MultiPolygon<F>) -> F
Point
to Point
is supported.
See specific implementations for details. Read moreSource§impl<T> EuclideanDistance<T> for Rect<T>
impl<T> EuclideanDistance<T> for Rect<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, Geometry<T>> for Rect<T>
impl<T> EuclideanDistance<T, Geometry<T>> for Rect<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 Rect<T>
impl<T> EuclideanDistance<T, GeometryCollection<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &GeometryCollection<T>) -> T
fn euclidean_distance(&self, other: &GeometryCollection<T>) -> T
Euclidean::distance
method from the Distance
trait insteadSource§impl<T> EuclideanDistance<T, Line<T>> for Rect<T>
impl<T> EuclideanDistance<T, Line<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &Line<T>) -> T
fn euclidean_distance(&self, other: &Line<T>) -> T
Euclidean::distance
method from the Distance
trait insteadSource§impl<T> EuclideanDistance<T, LineString<T>> for Rect<T>
impl<T> EuclideanDistance<T, LineString<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &LineString<T>) -> T
fn euclidean_distance(&self, other: &LineString<T>) -> T
Euclidean::distance
method from the Distance
trait insteadSource§impl<T> EuclideanDistance<T, MultiLineString<T>> for Rect<T>
impl<T> EuclideanDistance<T, MultiLineString<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &MultiLineString<T>) -> T
fn euclidean_distance(&self, other: &MultiLineString<T>) -> T
Euclidean::distance
method from the Distance
trait insteadSource§impl<T> EuclideanDistance<T, MultiPoint<T>> for Rect<T>
impl<T> EuclideanDistance<T, MultiPoint<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &MultiPoint<T>) -> T
fn euclidean_distance(&self, other: &MultiPoint<T>) -> T
Euclidean::distance
method from the Distance
trait insteadSource§impl<T> EuclideanDistance<T, MultiPolygon<T>> for Rect<T>
impl<T> EuclideanDistance<T, MultiPolygon<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &MultiPolygon<T>) -> T
fn euclidean_distance(&self, other: &MultiPolygon<T>) -> T
Euclidean::distance
method from the Distance
trait insteadSource§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, Polygon<T>> for Rect<T>
impl<T> EuclideanDistance<T, Polygon<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &Polygon<T>) -> T
fn euclidean_distance(&self, other: &Polygon<T>) -> T
Euclidean::distance
method from the Distance
trait insteadSource§impl<T> EuclideanDistance<T, Rect<T>> for Geometry<T>
impl<T> EuclideanDistance<T, Rect<T>> for Geometry<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, Rect<T>> for GeometryCollection<T>
impl<T> EuclideanDistance<T, Rect<T>> for GeometryCollection<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, Rect<T>> for Line<T>
impl<T> EuclideanDistance<T, Rect<T>> for Line<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, Rect<T>> for LineString<T>
impl<T> EuclideanDistance<T, Rect<T>> for LineString<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, Rect<T>> for MultiLineString<T>
impl<T> EuclideanDistance<T, Rect<T>> for MultiLineString<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, Rect<T>> for MultiPoint<T>
impl<T> EuclideanDistance<T, Rect<T>> for MultiPoint<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, Rect<T>> for MultiPolygon<T>
impl<T> EuclideanDistance<T, Rect<T>> for MultiPolygon<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, 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, Rect<T>> for Polygon<T>
impl<T> EuclideanDistance<T, Rect<T>> for Polygon<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, Rect<T>> for Triangle<T>
impl<T> EuclideanDistance<T, Rect<T>> for Triangle<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 Rect<T>
impl<T> EuclideanDistance<T, Triangle<T>> for Rect<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 Rect
impl GeodesicArea<f64> for Rect
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<C: CoordNum> HasDimensions for Rect<C>
impl<C: CoordNum> HasDimensions for Rect<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> HaversineClosestPoint<T> for Rect<T>where
T: GeoFloat + FromPrimitive,
impl<T> HaversineClosestPoint<T> for Rect<T>where
T: GeoFloat + FromPrimitive,
fn haversine_closest_point(&self, from: &Point<T>) -> Closest<T>
Source§impl<T> InteriorPoint for Rect<T>where
T: GeoFloat,
impl<T> InteriorPoint for Rect<T>where
T: GeoFloat,
Source§impl<T> Intersects<Coord<T>> for Rect<T>where
T: CoordNum,
impl<T> Intersects<Coord<T>> for Rect<T>where
T: CoordNum,
fn intersects(&self, rhs: &Coord<T>) -> bool
Source§impl<T> Intersects<Geometry<T>> for Rect<T>
impl<T> Intersects<Geometry<T>> for Rect<T>
fn intersects(&self, rhs: &Geometry<T>) -> bool
Source§impl<T> Intersects<GeometryCollection<T>> for Rect<T>
impl<T> Intersects<GeometryCollection<T>> for Rect<T>
fn intersects(&self, rhs: &GeometryCollection<T>) -> bool
Source§impl<T> Intersects<Line<T>> for Rect<T>where
T: GeoNum,
impl<T> Intersects<Line<T>> for Rect<T>where
T: GeoNum,
fn intersects(&self, rhs: &Line<T>) -> bool
Source§impl<T> Intersects<LineString<T>> for Rect<T>
impl<T> Intersects<LineString<T>> for Rect<T>
fn intersects(&self, rhs: &LineString<T>) -> bool
Source§impl<T> Intersects<MultiLineString<T>> for Rect<T>
impl<T> Intersects<MultiLineString<T>> for Rect<T>
fn intersects(&self, rhs: &MultiLineString<T>) -> bool
Source§impl<T> Intersects<MultiPoint<T>> for Rect<T>
impl<T> Intersects<MultiPoint<T>> for Rect<T>
fn intersects(&self, rhs: &MultiPoint<T>) -> bool
Source§impl<T> Intersects<MultiPolygon<T>> for Rect<T>
impl<T> Intersects<MultiPolygon<T>> for Rect<T>
fn intersects(&self, rhs: &MultiPolygon<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<Polygon<T>> for Rect<T>
impl<T> Intersects<Polygon<T>> for Rect<T>
fn intersects(&self, rhs: &Polygon<T>) -> bool
Source§impl<T> Intersects<Rect<T>> for Coord<T>
impl<T> Intersects<Rect<T>> for Coord<T>
fn intersects(&self, rhs: &Rect<T>) -> bool
Source§impl<T> Intersects<Rect<T>> for Line<T>
impl<T> Intersects<Rect<T>> for Line<T>
fn intersects(&self, rhs: &Rect<T>) -> bool
Source§impl<T> Intersects<Rect<T>> for Polygon<T>where
T: GeoNum,
impl<T> Intersects<Rect<T>> for Polygon<T>where
T: GeoNum,
fn intersects(&self, rect: &Rect<T>) -> bool
Source§impl<T> Intersects<Rect<T>> for Triangle<T>
impl<T> Intersects<Rect<T>> for Triangle<T>
fn intersects(&self, rhs: &Rect<T>) -> bool
Source§impl<T> Intersects<Triangle<T>> for Rect<T>where
T: GeoNum,
impl<T> Intersects<Triangle<T>> for Rect<T>where
T: GeoNum,
fn intersects(&self, rhs: &Triangle<T>) -> bool
Source§impl<T> Intersects for Rect<T>where
T: CoordNum,
impl<T> Intersects for Rect<T>where
T: CoordNum,
fn intersects(&self, other: &Rect<T>) -> bool
Source§impl<T: CoordNum, NT: CoordNum> MapCoords<T, NT> for Rect<T>
impl<T: CoordNum, NT: CoordNum> MapCoords<T, NT> for Rect<T>
Source§impl<T: CoordNum> MapCoordsInPlace<T> for Rect<T>
impl<T: CoordNum> MapCoordsInPlace<T> for Rect<T>
Source§impl<F: GeoFloat> Relate<F> for Rect<F>
impl<F: GeoFloat> Relate<F> for Rect<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 Rect<T>
impl<T> RelativeEq for Rect<T>
Source§fn relative_eq(
&self,
other: &Rect<T>,
epsilon: <Rect<T> as AbsDiffEq>::Epsilon,
max_relative: <Rect<T> as AbsDiffEq>::Epsilon,
) -> bool
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
fn default_max_relative() -> <Rect<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 Rect<T>where
T: CoordNum + FromPrimitive,
impl<T> RemoveRepeatedPoints<T> for Rect<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> TryFrom<Geometry<T>> for Rect<T>where
T: CoordNum,
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.
impl<T> Copy for Rect<T>
impl<T> Eq for Rect<T>
impl<T> StructuralPartialEq for Rect<T>where
T: CoordNum,
Auto Trait Implementations§
impl<T> Freeze for Rect<T>where
T: Freeze,
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
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<T> Pointable for T
impl<T> Pointable for T
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
.