pub struct Polygon<P: PointTrait, const CLOCKWISE: bool = true, const CLOSED: bool = true> {
pub outer: Ring<P, CLOCKWISE, CLOSED>,
pub inners: Vec<Ring<P, CLOCKWISE, CLOSED>>,
}Expand description
Default Polygon — an outer Ring and a Vec of inner rings,
all sharing the same point type and the same closure / traversal
const generics.
Mirrors boost::geometry::model::polygon<Point, ClockWise, Closed>
from boost/geometry/geometries/polygon.hpp:66-100. The defaults
(CLOCKWISE = true, CLOSED = true) match Boost’s defaults
(boost/geometry/geometries/polygon.hpp:69-70).
Fields§
§outer: Ring<P, CLOCKWISE, CLOSED>The exterior ring (outer boundary). Mirrors m_outer in
boost/geometry/geometries/polygon.hpp:139.
inners: Vec<Ring<P, CLOCKWISE, CLOSED>>The interior rings (holes), in declared order. Mirrors
m_inners in boost/geometry/geometries/polygon.hpp:140.
Implementations§
Source§impl<P: PointTrait, const CW: bool, const CL: bool> Polygon<P, CW, CL>
impl<P: PointTrait, const CW: bool, const CL: bool> Polygon<P, CW, CL>
Sourcepub const fn new(outer: Ring<P, CW, CL>) -> Self
pub const fn new(outer: Ring<P, CW, CL>) -> Self
Construct a polygon from an outer ring with no holes.
Rust analogue of constructing a boost::geometry::model::polygon
then assigning to .outer() and leaving .inners() empty
(boost/geometry/geometries/polygon.hpp:87-91, 96-101).
Sourcepub const fn with_inners(
outer: Ring<P, CW, CL>,
inners: Vec<Ring<P, CW, CL>>,
) -> Self
pub const fn with_inners( outer: Ring<P, CW, CL>, inners: Vec<Ring<P, CW, CL>>, ) -> Self
Construct a polygon from an outer ring plus a Vec of inner
rings.
Rust analogue of constructing a boost::geometry::model::polygon
and then assigning to both .outer() and .inners()
(boost/geometry/geometries/polygon.hpp:87-91).
Trait Implementations§
Source§impl<P: Clone + PointTrait, const CLOCKWISE: bool, const CLOSED: bool> Clone for Polygon<P, CLOCKWISE, CLOSED>
impl<P: Clone + PointTrait, const CLOCKWISE: bool, const CLOSED: bool> Clone for Polygon<P, CLOCKWISE, CLOSED>
Source§impl<P: Debug + PointTrait, const CLOCKWISE: bool, const CLOSED: bool> Debug for Polygon<P, CLOCKWISE, CLOSED>
impl<P: Debug + PointTrait, const CLOCKWISE: bool, const CLOSED: bool> Debug for Polygon<P, CLOCKWISE, CLOSED>
Source§impl<P: PointTrait, const CW: bool, const CL: bool> Geometry for Polygon<P, CW, CL>
Tag this concrete type as a Polygon. Mirrors the
traits::tag<model::polygon<...>> specialisation at
boost/geometry/geometries/polygon.hpp:158-172.
impl<P: PointTrait, const CW: bool, const CL: bool> Geometry for Polygon<P, CW, CL>
Tag this concrete type as a Polygon. Mirrors the
traits::tag<model::polygon<...>> specialisation at
boost/geometry/geometries/polygon.hpp:158-172.
Source§impl<P: PartialEq + PointTrait, const CLOCKWISE: bool, const CLOSED: bool> PartialEq for Polygon<P, CLOCKWISE, CLOSED>
impl<P: PartialEq + PointTrait, const CLOCKWISE: bool, const CLOSED: bool> PartialEq for Polygon<P, CLOCKWISE, CLOSED>
Source§impl<P: PointTrait, const CW: bool, const CL: bool> Polygon for Polygon<P, CW, CL>
Wire the Polygon concept up. The exterior() accessor hands back
&self.outer and interiors() hands back self.inners.iter() —
slice::Iter is already ExactSizeIterator. Mirrors the
traits::exterior_ring and traits::interior_rings specialisations
at boost/geometry/geometries/polygon.hpp:200-260 that dispatch on
the same generic parameters.
impl<P: PointTrait, const CW: bool, const CL: bool> Polygon for Polygon<P, CW, CL>
Wire the Polygon concept up. The exterior() accessor hands back
&self.outer and interiors() hands back self.inners.iter() —
slice::Iter is already ExactSizeIterator. Mirrors the
traits::exterior_ring and traits::interior_rings specialisations
at boost/geometry/geometries/polygon.hpp:200-260 that dispatch on
the same generic parameters.