pub struct Polygon<P> {
pub outer_contour: ClosedContour<P>,
pub inner_contours: Vec<ClosedContour<P>>,
}Expand description
Simple implementation of the Polygon trait.
Fields§
§outer_contour: ClosedContour<P>Outer contour.
inner_contours: Vec<ClosedContour<P>>Inner contours.
Implementations§
Source§impl<P> Polygon<P>
impl<P> Polygon<P>
Sourcepub fn new(
outer_contour: ClosedContour<P>,
inner_contours: Vec<ClosedContour<P>>,
) -> Self
pub fn new( outer_contour: ClosedContour<P>, inner_contours: Vec<ClosedContour<P>>, ) -> Self
Creates a new polygon.
Sourcepub fn cast_points<T>(&self, cast: impl Fn(&P) -> T) -> Polygon<T>
pub fn cast_points<T>(&self, cast: impl Fn(&P) -> T) -> Polygon<T>
Casts all points of the polygon into a different numeric type.
Trait Implementations§
Source§impl<'de, P> Deserialize<'de> for Polygon<P>where
P: Deserialize<'de>,
impl<'de, P> Deserialize<'de> for Polygon<P>where
P: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<P> From<ClosedContour<P>> for Polygon<P>
impl<P> From<ClosedContour<P>> for Polygon<P>
Source§fn from(value: ClosedContour<P>) -> Self
fn from(value: ClosedContour<P>) -> Self
Converts to this type from the input type.
Source§impl<P: GeometryType> GeometryType for Polygon<P>
impl<P: GeometryType> GeometryType for Polygon<P>
Source§impl<P: Ord> Ord for Polygon<P>
impl<P: Ord> Ord for Polygon<P>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<P: PartialOrd> PartialOrd for Polygon<P>
impl<P: PartialOrd> PartialOrd for Polygon<P>
Source§impl<P: Copy> Polygon for Polygon<P>
impl<P: Copy> Polygon for Polygon<P>
Source§type Contour = ClosedContour<P>
type Contour = ClosedContour<P>
Contour type.
Source§fn outer_contour(&self) -> &Self::Contour
fn outer_contour(&self) -> &Self::Contour
Outer contour of the polygon.
Source§fn inner_contours(&self) -> impl Iterator<Item = &Self::Contour>
fn inner_contours(&self) -> impl Iterator<Item = &Self::Contour>
iterates over inner contours.
Source§fn iter_contours(&self) -> impl Iterator<Item = &Self::Contour>
fn iter_contours(&self) -> impl Iterator<Item = &Self::Contour>
Iterates over all contours of the polygon starting with the outer one.
impl<P: Eq> Eq for Polygon<P>
impl<P> StructuralPartialEq for Polygon<P>
Auto Trait Implementations§
impl<P> Freeze for Polygon<P>
impl<P> RefUnwindSafe for Polygon<P>where
P: RefUnwindSafe,
impl<P> Send for Polygon<P>where
P: Send,
impl<P> Sync for Polygon<P>where
P: Sync,
impl<P> Unpin for Polygon<P>where
P: Unpin,
impl<P> UnwindSafe for Polygon<P>where
P: UnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<P, Poly> CartesianGeometry2dSpecialization<P, PolygonGeometryType> for Polywhere
Poly: CartesianPolygon<Point = P> + GeometryType<Type = PolygonGeometryType, Space = CartesianSpace2d> + Geometry<Point = P> + Polygon,
P: CartesianPoint2d + Copy,
<Poly as Polygon>::Contour: Contour<Point = P> + CartesianGeometry2d<P>,
impl<P, Poly> CartesianGeometry2dSpecialization<P, PolygonGeometryType> for Polywhere
Poly: CartesianPolygon<Point = P> + GeometryType<Type = PolygonGeometryType, Space = CartesianSpace2d> + Geometry<Point = P> + Polygon,
P: CartesianPoint2d + Copy,
<Poly as Polygon>::Contour: Contour<Point = P> + CartesianGeometry2d<P>,
Source§fn is_point_inside_spec<Other>(
&self,
point: &Other,
_tolerance: <P as CartesianPoint2d>::Num,
) -> bool
fn is_point_inside_spec<Other>( &self, point: &Other, _tolerance: <P as CartesianPoint2d>::Num, ) -> bool
Source§fn bounding_rectangle_spec(&self) -> Option<Rect<<P as CartesianPoint2d>::Num>>
fn bounding_rectangle_spec(&self) -> Option<Rect<<P as CartesianPoint2d>::Num>>
Source§impl<P, C, T> CartesianPolygon for T
impl<P, C, T> CartesianPolygon for T
Source§fn contains_point<Point>(&self, point: &Point) -> bool
fn contains_point<Point>(&self, point: &Point) -> bool
Returns true if the
point lies inside or on one of the polygon’s sides.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CoordinateMetadata for Twhere
T: ?Sized,
impl<T> CoordinateMetadata for Twhere
T: ?Sized,
Source§impl<T> Disambiguate for Twhere
T: GeometryType<Space = AmbiguousSpace>,
impl<T> Disambiguate for Twhere
T: GeometryType<Space = AmbiguousSpace>,
Source§fn to_geo2d(self) -> Disambig<Self, GeoSpace2d>where
Self: Sized,
fn to_geo2d(self) -> Disambig<Self, GeoSpace2d>where
Self: Sized,
Specifies that the geometry is in geographic coordinates.
Source§fn to_cartesian2d(self) -> Disambig<Self, CartesianSpace2d>where
Self: Sized,
fn to_cartesian2d(self) -> Disambig<Self, CartesianSpace2d>where
Self: Sized,
Specifies that the geometry is in cartesian coordinates.
Source§impl<Poly, Space> GeometrySpecialization<PolygonGeometryType, Space> for Polywhere
Poly: Polygon + GeometryType<Type = PolygonGeometryType, Space = Space>,
<Poly as Polygon>::Contour: Geometry,
impl<Poly, Space> GeometrySpecialization<PolygonGeometryType, Space> for Polywhere
Poly: Polygon + GeometryType<Type = PolygonGeometryType, Space = Space>,
<Poly as Polygon>::Contour: Geometry,
Source§type Point = <<Poly as Polygon>::Contour as Geometry>::Point
type Point = <<Poly as Polygon>::Contour as Geometry>::Point
Type of the point of the geometry.
Source§fn project_spec<Proj>(
&self,
projection: &Proj,
) -> Option<Geom<<Proj as Projection>::OutPoint>>where
Proj: Projection<InPoint = <Poly as GeometrySpecialization<PolygonGeometryType, Space>>::Point> + ?Sized,
fn project_spec<Proj>(
&self,
projection: &Proj,
) -> Option<Geom<<Proj as Projection>::OutPoint>>where
Proj: Projection<InPoint = <Poly as GeometrySpecialization<PolygonGeometryType, Space>>::Point> + ?Sized,
See
Geometry::project.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.