Tired of forever converting back and forwards between degrees and radians? Well worry no more; Angle is here to make your life simple!
Go to file
Renovate Bot d55adf88c0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
chore(deps): update dependency erlang to v26.2.4
2024-04-13 00:26:41 +12:00
config chore: migrate to local (#20) 2024-02-14 12:01:04 +13:00
lib chore: update ' to ~c. 2023-07-09 13:52:06 +12:00
test Implement abs for each angle. 2017-11-05 13:45:07 +13:00
.drone.yml chore: fix docs release. 2024-03-14 19:20:32 +13:00
.formatter.exs Update CI config and dependencies. 2018-09-04 03:10:02 +00:00
.gitignore Implement abs for each angle. 2017-11-05 13:45:07 +13:00
.tool-versions chore(deps): update dependency erlang to v26.2.4 2024-04-13 00:26:41 +12:00
CHANGELOG.md chore: release version v1.0.1 2024-02-23 19:43:33 +13:00
LICENSE.md chore: fix copyright notice. 2023-01-17 10:47:21 +13:00
mix.exs chore(deps): update dependency ex_check to ~> 0.16 2024-03-01 23:17:48 +13:00
mix.lock chore(deps): update dependency git_ops to v2.6.0 2024-03-14 14:24:09 +13:00
README.md chore: fix typo in readme 2024-03-08 14:42:57 +13:00
renovate.json chore: Configure Renovate (#21) 2024-02-14 17:43:58 +13:00

Angle

Build Status Hex.pm Hippocratic License HL3-FULL

Tired of forever converting back and forwards between degrees and radians? Well worry no more; Angle is here to make your life simple!

Magic sigils

Angle defines the ~a sigil so that you can create an Angle easily.

Examples

Creating an Angle from decimal degrees:

iex> use Angle
...> ~a(13.2)d
#Angle<13.2°>

Creating an Angle from radians:

iex> use Angle
...> ~a(0.25)r
#Angle<0.25㎭>

Creating an Angle from gradians:

iex> use Angle
...> ~a(40)g
#Angle<40ᵍ>

Create an Angle from degrees, minutes and seconds:

iex> use Angle
...> ~a(90,30,50)dms
#Angle<90° 30 50″>

Lazy converstion

Most functions in Angle return a potentially modified version of the angle, so that if the angle needs to be converted to radians or degrees for the underlying function to work, then it'll only be done once.

Examples

Returning the radian representation of an angle

  iex> use Angle
  ...> ~a(13)d
  ...> |> Angle.to_radians()
  ...> |> inspect()
  "{#Angle<13°>, 0.22689280275926282}"

Installation

Angle is available in Hex, the package can be installed by adding angle to your list of dependencies in mix.exs:

def deps do
  [
    {:angle, "~> 1.0.1"}
  ]
end

Documentation for the latest release can be found on HexDocs and for the main branch on docs.harton.nz.

Github Mirror

This repository is mirrored on Github from it's primary location on my Forgejo instance. Feel free to raise issues and open PRs on Github.

License

This software is licensed under the terms of the HL3-FULL, see the LICENSE.md file included with this package for the terms.

This license actively proscribes this software being used by and for some industries, countries and activities. If your usage of this software doesn't comply with the terms of this license, then contact me with the details of your use-case to organise the purchase of a license - the cost of which may include a donation to a suitable charity or NGO.