View Source Geometry.PolygonZ (Geometry v0.4.0)

A polygon struct, representing a 3D polygon.

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

Link to this section Summary

Functions

Creates an empty PolygonZ.

Creates a PolygonZ from the given rings.

Link to this section Types

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

Link to this section Functions

@spec new() :: t()

Creates an empty PolygonZ.

examples

Examples

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

Creates a PolygonZ from the given rings.

examples

Examples

iex> PolygonZ.new([
...>   LineStringZ.new([
...>     PointZ.new(35, 10, 13),
...>     PointZ.new(45, 45, 23),
...>     PointZ.new(10, 20, 33),
...>     PointZ.new(35, 10, 13)
...>   ]),
...>   LineStringZ.new([
...>     PointZ.new(20, 30, 13),
...>     PointZ.new(35, 35, 23),
...>     PointZ.new(30, 20, 33),
...>     PointZ.new(20, 30, 13)
...>   ])
...> ])
%PolygonZ{
  rings: [
    [[35, 10, 13], [45, 45, 23], [10, 20, 33], [35, 10, 13]],
    [[20, 30, 13], [35, 35, 23], [30, 20, 33], [20, 30, 13]]
  ]
}

iex> PolygonZ.new()
%PolygonZ{}