Planet v0.1.1 GEOF.Planet.Geometry

Functions for computing a Planet’s geometry.

Link to this section Summary

Types

position encodes coordinates on the Sphere in the Geographic Coordinate System as tuples of the format {:pos, latitude, longitude}, i.e. {:pos, φ, λ}, where -π/2 ≤ φ ≤ π/2 and 0 ≤ λ ≤ 2π

Functions

Computes the centroid of a polygon on the surface of the sphere defined by a list of positions

Returns the heading and distance from the first position to the second position

Returns the arclength between two points on the sphere

Calls fun divisions-1 times, once for each point spaced evenly between two points on the sphere, and reduces the init_acc into a final value

The apparent accuracy of Erlang’s trigonometry

Link to this section Types

Link to this type position()
position() :: {:pos, float(), float()}

position encodes coordinates on the Sphere in the Geographic Coordinate System as tuples of the format {:pos, latitude, longitude}, i.e. {:pos, φ, λ}, where -π/2 ≤ φ ≤ π/2 and 0 ≤ λ ≤ 2π.

Link to this section Functions

Link to this function centroid(positions)
centroid([position(), ...]) :: position() | {:error, String.t()}

Computes the centroid of a polygon on the surface of the sphere defined by a list of positions.

Link to this function course(position_1, position_2)
course(position(), position()) :: {:course, float(), float()}

Returns the heading and distance from the first position to the second position.

Used only for testing, so documentation is sparse.

Link to this function distance(position_1, position_2)
distance(position(), position()) :: float()

Returns the arclength between two points on the sphere.

Link to this function interpolate(acc, divisions, position_1, position_2, fun)
interpolate(
  any(),
  GEOF.Sphere.divisions(),
  position(),
  position(),
  (any(), integer(), position() -> any())
) :: any()

Calls fun divisions-1 times, once for each point spaced evenly between two points on the sphere, and reduces the init_acc into a final value.

The apparent accuracy of Erlang’s trigonometry.