Angle.Radian (angle v1.0.1)
Functions relating to dealing with angles in Radians.
Link to this section Summary
Functions
Convert the angle to it's absolute value by discarding complete revolutions and converting negatives.
Ensure that a radian representation is present for this angle, otherwise calculate one.
Initialize an Angle from a number n
of radians
Attempt to parse decimal radians.
Return the radians 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(-4.71238898038469)r
...> |> Angle.Radian.abs()
#Angle<1.5707963267948966㎭>
iex> ~a(20.420352248333657)r
...> |> Angle.Radian.abs()
#Angle<1.5707963267948983㎭>
Link to this function
ensure(angle)
Ensure that a radian representation is present for this angle, otherwise calculate one.
Examples
iex> ~a(90)d
...> |> ensure()
...> |> Map.get(:r)
1.5707963267948966
iex> ~a(76.3944)g
...> |> ensure()
...> |> Map.get(:r)
1.2000004290770006
iex> ~a(90,0,0)dms
...> |> ensure()
...> |> Map.get(:r)
1.5707963267948966
Link to this function
init(n)
Initialize an Angle from a number n
of radians
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 parse decimal radians.
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㎭>}"
Link to this function
to_radians(angle)
Return the radians representation of the Angle.
Examples
iex> ~a(90)d
...> |> to_radians()
...> |> inspect()
"{#Angle<90°>, 1.5707963267948966}"