View Source Geometry.PolygonM (Geometry v0.4.0)

A polygon struct, representing a 2D polygon with a measurement.

A none empty line-string requires at least one ring with four points.

Link to this section Summary

Functions

Creates an empty PolygonM.

Creates a PolygonM from the given rings.

Link to this section Types

@type t() :: %Geometry.PolygonM{rings: [Geometry.coordinates()]}

Link to this section Functions

@spec new() :: t()

Creates an empty PolygonM.

examples

Examples

iex> PolygonM.new()
%PolygonM{rings: []}
@spec new([Geometry.LineStringM.t()]) :: t()

Creates a PolygonM from the given rings.

examples

Examples

iex> PolygonM.new([
...>   LineStringM.new([
...>     PointM.new(35, 10, 14),
...>     PointM.new(45, 45, 24),
...>     PointM.new(10, 20, 34),
...>     PointM.new(35, 10, 14)
...>   ]),
...>   LineStringM.new([
...>     PointM.new(20, 30, 14),
...>     PointM.new(35, 35, 24),
...>     PointM.new(30, 20, 34),
...>     PointM.new(20, 30, 14)
...>   ])
...> ])
%PolygonM{
  rings: [
    [[35, 10, 14], [45, 45, 24], [10, 20, 34], [35, 10, 14]],
    [[20, 30, 14], [35, 35, 24], [30, 20, 34], [20, 30, 14]]
  ]
}

iex> PolygonM.new()
%PolygonM{}