pub struct Polygon {
    points: Vec<Pt2D>,
    indices: Vec<u16>,
    rings: Option<Vec<Ring>>,
}

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.

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

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.

Usually m^2, unless the polygon is in screen-space

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.

An arbitrary placeholder value, when Option types aren’t worthwhile

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.