Skip to main content

Polygon

Struct Polygon 

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

Source

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).

Source

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>

Source§

fn clone(&self) -> Polygon<P, CLOCKWISE, CLOSED>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<P: Debug + PointTrait, const CLOCKWISE: bool, const CLOSED: bool> Debug for Polygon<P, CLOCKWISE, CLOSED>

Source§

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

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

impl<P: PointTrait, const CW: bool, const CL: bool> Default for Polygon<P, CW, CL>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
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.

Source§

type Kind = PolygonTag

One of the *Tag types from geometry_tag. Read more
Source§

type Point = P

The point type this geometry is built from. For a value modelling Point, this is Self. Read more
Source§

impl<P: PartialEq + PointTrait, const CLOCKWISE: bool, const CLOSED: bool> PartialEq for Polygon<P, CLOCKWISE, CLOSED>

Source§

fn eq(&self, other: &Polygon<P, CLOCKWISE, CLOSED>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
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.

Source§

type Ring = Ring<P, CW, CL>

The ring type used for both the exterior and the interior rings. Read more
Source§

fn exterior(&self) -> &Self::Ring

The exterior ring (outer boundary) of this polygon. Read more
Source§

fn interiors(&self) -> impl ExactSizeIterator<Item = &Self::Ring>

The interior rings (holes) of this polygon, in declared order. Read more
Source§

impl<A, const D: usize, OldCs, T, Cs, const CW: bool, const CL: bool> RebindGeometry<T, Cs> for Polygon<Point<A, D, OldCs>, CW, CL>

Source§

type Output = Polygon<Point<T, D, Cs>, CW, CL>

The corresponding rebound stock model.
Source§

impl<P: PartialEq + PointTrait, const CLOCKWISE: bool, const CLOSED: bool> StructuralPartialEq for Polygon<P, CLOCKWISE, CLOSED>

Auto Trait Implementations§

§

impl<P, const CLOCKWISE: bool, const CLOSED: bool> Freeze for Polygon<P, CLOCKWISE, CLOSED>

§

impl<P, const CLOCKWISE: bool, const CLOSED: bool> RefUnwindSafe for Polygon<P, CLOCKWISE, CLOSED>
where P: RefUnwindSafe,

§

impl<P, const CLOCKWISE: bool, const CLOSED: bool> Send for Polygon<P, CLOCKWISE, CLOSED>
where P: Send,

§

impl<P, const CLOCKWISE: bool, const CLOSED: bool> Sync for Polygon<P, CLOCKWISE, CLOSED>
where P: Sync,

§

impl<P, const CLOCKWISE: bool, const CLOSED: bool> Unpin for Polygon<P, CLOCKWISE, CLOSED>
where P: Unpin,

§

impl<P, const CLOCKWISE: bool, const CLOSED: bool> UnsafeUnpin for Polygon<P, CLOCKWISE, CLOSED>

§

impl<P, const CLOCKWISE: bool, const CLOSED: bool> UnwindSafe for Polygon<P, CLOCKWISE, CLOSED>
where P: UnwindSafe,

Blanket Implementations§

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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> SameAs<T> for T

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