angle v0.3.0 Angle.Gradian
Functions relating to dealing with angles in Gradians.
Link to this section Summary
Functions
Convert the angle to it’s absolute value by discarding complete revolutions and converting negatives
Ensure that a gradian representation is present for this angle, otherwise calculate one
Initialize an Angle from a number n
of gradians
Attempt to arse decimal gradians
Return the gradians 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(-300)g
...> |> Angle.Gradian.abs()
#Angle<100ᵍ>
iex> ~a(1300)g
...> |> Angle.Gradian.abs()
#Angle<100ᵍ>
Ensure that a gradian representation is present for this angle, otherwise calculate one.
Examples
iex> ~a(90)d
...> |> ensure()
...> |> Map.get(:g)
100.0
iex> ~a(1)r
...> |> ensure()
...> |> Map.get(:g)
63.66197723675813
iex> ~a(90 0 0)dms
...> |> ensure()
...> |> Map.get(:g)
100.0
Initialize an Angle from a number n
of gradians
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 arse decimal gradians.
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ᵍ>}"