angle v0.3.0 Angle.Radian
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
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㎭>
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
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>
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㎭>}"