Angle.Gradian (angle v1.0.1)
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
Link to this function
abs(angle)
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ᵍ>
Link to this function
ensure(angle)
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
Link to this function
init(n)
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>
Link to this function
parse(value)
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ᵍ>}"
Link to this function
to_gradians(angle)
Return the gradians representation of the Angle.
Examples
iex> use Angle
...> ~a(0.5)r
...> |> to_gradians()
...> |> inspect()
"{#Angle<0.5㎭>, 31.830988618379067}"