struct Geo::Polygon
- Geo::Polygon
- Struct
- Value
- Object
Overview
A Polygon
is a fixed-size, immutable, stack-allocated sequence of Geo::Coord
.
Coordinates are in lexicographical order.
Additionally, polygons form a closed loop and define a filled region.
Included Modules
- Indexable(Geo::Coord)
Defined in:
geo/polygon.crConstructors
Instance Method Summary
- #==(other : Geo::Polygon) : Bool
-
#area
Return the approximate signed geodesic area of the polygon in square meters.
- #centroid : Geo::Coord
- #contains?(coord : Geo::Coord) : Bool
- #coords : Array(Geo::Coord)
-
#size : Int32
Returns the number of elements in this container.
- #to_geojson : GeoJSON::Polygon
-
#unsafe_fetch(index : Int)
Returns the element at the given index, without doing any bounds check.
Constructor Detail
Instance Method Detail
Returns the number of elements in this container.
Returns the element at the given index, without doing any bounds check.
Indexable
makes sure to invoke this method with index in 0...size
,
so converting negative indices to positive ones is not needed here.
Clients never invoke this method directly. Instead, they access
elements with #[](index)
and #[]?(index)
.
This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.