Geometry.CompoundCurve
(Geometry v1.2.0)
View Source
A compound-curve struct, representing a 2D curve.
A CompoundCurve is a single continuous curve that may contain both CircularString segments and LineString segments. Each segment must connect to the next segment (the end point of one segment must equal the start point of the next segment).
Summary
Types
@type segment() :: Geometry.LineString.t() | Geometry.CircularString.t()
@type t() :: %Geometry.CompoundCurve{segments: [segment()], srid: Geometry.srid()}
Functions
@spec new() :: t()
Creates an empty CompoundCurve.
Examples
iex> Geometry.CompoundCurve.new()
%Geometry.CompoundCurve{segments: [], srid: 0}
@spec new([segment()], Geometry.srid()) :: t()
Creates a CompoundCurve from the given segments.
Examples
iex> Geometry.CompoundCurve.new([
...> Geometry.LineString.new([Geometry.Point.new(1, 0), Geometry.Point.new(0, 1)])
...> ])
%Geometry.CompoundCurve{
segments: [%Geometry.LineString{path: [[1, 0], [0, 1]], srid: 0}],
srid: 0
}
iex> Geometry.CompoundCurve.new(
...> [Geometry.LineString.new([Geometry.Point.new(1, 2), Geometry.Point.new(3, 4)])],
...> 4326
...> )
%Geometry.CompoundCurve{
segments: [%Geometry.LineString{path: [[1, 2], [3, 4]], srid: 0}],
srid: 4326
}