View Source Geometry.PolygonZM (Geometry v0.4.0)

A polygon struct, representing a 3D 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 PolygonZM.

Creates a PolygonZM from the given rings.

Link to this section Types

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

Link to this section Functions

@spec new() :: t()

Creates an empty PolygonZM.

examples

Examples

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

Creates a PolygonZM from the given rings.

examples

Examples

iex> PolygonZM.new([
...>   LineStringZM.new([
...>     PointZM.new(35, 10, 13, 14),
...>     PointZM.new(45, 45, 23, 24),
...>     PointZM.new(10, 20, 33, 34),
...>     PointZM.new(35, 10, 13, 14)
...>   ]),
...>   LineStringZM.new([
...>     PointZM.new(20, 30, 13, 14),
...>     PointZM.new(35, 35, 23, 24),
...>     PointZM.new(30, 20, 33, 34),
...>     PointZM.new(20, 30, 13, 14)
...>   ])
...> ])
%PolygonZM{
  rings: [
    [[35, 10, 13, 14], [45, 45, 23, 24], [10, 20, 33, 34], [35, 10, 13, 14]],
    [[20, 30, 13, 14], [35, 35, 23, 24], [30, 20, 33, 34], [20, 30, 13, 14]]
  ]
}

iex> PolygonZM.new()
%PolygonZM{}