pub struct Polygon {
pub outer: Ring,
pub holes: Vec<Ring>,
}Fields§
§outer: Ring§holes: Vec<Ring>Implementations§
Source§impl Polygon
impl Polygon
Sourcepub fn outline(&self) -> Polygon2
pub fn outline(&self) -> Polygon2
The outer boundary as a Polygon2, discarding any holes.
Named outline rather than offered as a From impl because the
conversion is lossy and the loss is silent: an annulus and a filled
disc have the same outline, so a caller that reaches for this to
compute area gets the wrong answer with no error. Polygon2 models a
simple polygon and cannot represent a hole, which is exactly why this
has to be an explicit request rather than an implicit coercion.
Use polygon_area when the holes matter.
Trait Implementations§
impl StructuralPartialEq for Polygon
Auto Trait Implementations§
impl Freeze for Polygon
impl RefUnwindSafe for Polygon
impl Send for Polygon
impl Sync for Polygon
impl Unpin for Polygon
impl UnwindSafe for Polygon
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