#[non_exhaustive]pub enum PolygonError {
NoOuterRing,
TooFewVertices {
ring: RingId,
count: usize,
},
RepeatedVertex {
ring: RingId,
index: usize,
point: Point,
},
DegenerateRing {
ring: RingId,
},
Spike {
ring: RingId,
vertex: VertexId,
},
SelfIntersection {
a: EdgeId,
b: EdgeId,
},
HoleOutsideOuter {
ring: RingId,
},
TooManyVertices {
count: usize,
max: usize,
},
CoordinateOutOfRange {
ring: RingId,
point: Point,
},
}Expand description
Why a Polygon could not be built.
Every variant names the ring (and where meaningful the vertex or edge) responsible, so the caller can point at the offending input rather than guessing.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NoOuterRing
A polygon needs an outer ring; none was supplied.
TooFewVertices
A ring had fewer than three distinct vertices.
RepeatedVertex
A ring repeated a vertex back to back, giving a zero-length edge.
Fields
DegenerateRing
A ring encloses no area (every vertex is collinear).
Spike
A ring doubles back on itself through 180°, forming a zero-width spike.
The wavefront vertex at such a corner would have to move infinitely fast, so the skeleton is undefined there. Nudge the spike tip sideways by one unit, or drop it.
SelfIntersection
Two edges of the polygon cross. Simple polygons only.
HoleOutsideOuter
A hole is not contained in the outer ring.
TooManyVertices
The polygon has more vertices than EdgeId can number.
CoordinateOutOfRange
A vertex lies outside the crate’s coordinate range.
Coordinates are capped at Point::MIN_COORD..=Point::MAX_COORD,
one bit narrower than i16. That bit is what makes every predicate
exact in i32 and lets the whole algorithm run without f64 — see
Point and crate::predicates. Scale the input down to fit.
Trait Implementations§
Source§impl Clone for PolygonError
impl Clone for PolygonError
Source§fn clone(&self) -> PolygonError
fn clone(&self) -> PolygonError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PolygonError
impl Debug for PolygonError
Source§impl Display for PolygonError
impl Display for PolygonError
impl Eq for PolygonError
Source§impl Error for PolygonError
Available on crate feature std only.
impl Error for PolygonError
std only.1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()