Struct geom::Polygon [−][src]
Fields
points: Vec<Pt2D>
indices: Vec<u16>
Groups of three indices make up the triangles
rings: Option<Vec<Ring>>
If the polygon has holes, explicitly store all the rings (the one outer and all of the inner) so they can later be used to generate outlines and such. If the polygon has no holes, then this will just be None, since the points form a ring.
Implementations
Does this polygon contain the point either in the interior or right on the border? Haven’t tested carefully for polygons with holes.
The order of these points depends on the constructor! The first and last point may or may not match. Polygons constructed from PolyLines will have a very weird order.
pub fn into_points(self) -> Vec<Pt2D>ⓘ
Get the outer ring of this polygon. This should usually succeed.
Top-left at the origin. Doesn’t take Distance, because this is usually pixels, actually.
Top-left at the origin. Doesn’t take Distance, because this is usually pixels, actually.
A rectangle, two sides of which are fully rounded half-circles.
Top-left at the origin. Doesn’t take Distance, because this is usually pixels, actually. If it’s not possible to apply the specified radius, fallback to a regular rectangle.
Union all of the polygons into one geo::MultiPolygon
pub fn intersection(&self, other: &Polygon) -> Vec<Polygon>ⓘ
Find the “pole of inaccessibility” – the most distant internal point from the polygon outline
Do two polygons intersect at all?
Does this polygon intersect a polyline?
Creates the outline around the polygon, with the thickness half straddling the polygon and half of it just outside. Only works for polygons that’re formed from rings. Those made from PolyLines won’t work, for example.
Remove the internal rings used for to_outline. This is fine to do if the polygon is being added to some larger piece of geometry that won’t need an outline.
Doesn’t handle multiple crossings in and out.
If the polygon is just a single outer ring, produces a GeoJSON polygon. Otherwise, produces a GeoJSON multipolygon consisting of individual triangles. Optionally map the world-space points back to GPS.
Extracts all polygons from raw bytes representing a GeoJSON file, along with the string
key/value properties. Only the first polygon from multipolygons is returned. If
require_in_bounds
is set, then the polygon must completely fit within the gps_bounds
.
Trait Implementations
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
Auto Trait Implementations
impl RefUnwindSafe for Polygon
impl UnwindSafe for Polygon
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self