angle v0.3.0 Angle.Degree
Functions relating to dealing with angles in real Degrees.
Link to this section Summary
Functions
Convert the angle to it’s absolute value by discarding complete revolutions and converting negatives
Ensure that a degree representation is present for this angle, otherwise calculate one
Initialize an Angle from a number n
of degrees
Attempt to parse decimal degrees
Return the degrees representation of the Angle
Link to this section Functions
Convert the angle to it’s absolute value by discarding complete revolutions and converting negatives.
Examples
iex> ~a(-270)d
...> |> Angle.Degree.abs()
#Angle<90°>
iex> ~a(1170)d
...> |> Angle.Degree.abs()
#Angle<90°>
Ensure that a degree representation is present for this angle, otherwise calculate one.
Examples
iex> ~a(0.5)r
...> |> ensure()
...> |> Map.get(:d)
28.64788975654116
iex> ~a(76.3944)g
...> |> ensure()
...> |> Map.get(:d)
68.75496000000001
iex> ~a(77 50 56)dms
...> |> ensure()
...> |> Map.get(:d)
77.84888888888888
Initialize an Angle from a number n
of degrees
Examples
iex> init(13)
#Angle<13°>
iex> init(13.2)
#Angle<13.2°>
iex> init(0)
#Angle<0>
iex> init(0.0)
#Angle<0>
Attempt to parse decimal degrees.
Examples
iex> "13" |> parse() |> inspect()
"{:ok, #Angle<13°>}"
iex> "13.2" |> parse() |> inspect()
"{:ok, #Angle<13.2°>}"
iex> "13°" |> parse() |> inspect()
"{:ok, #Angle<13°>}"
iex> "13.2°" |> parse() |> inspect()
"{:ok, #Angle<13.2°>}"
iex> "-13.2°" |> parse() |> inspect()
"{:ok, #Angle<-13.2°>}"