Degrad 1.2.0

Degrad 1.2.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Aug 2019
SPMSupports SPM

Maintained by Daniel Clelland.



Degrad 1.2.0

  • By
  • Daniel Clelland

Degrad

Degrad is a microlibrary for working with angles. It provides functions from converting degrees to radians, and rectangular to polar coordinates.

Degrad works by implementing Degradable and Polrectable protocols on Float, Double, and CGFloat.

Examples

✓ Terse unit syntax

180.degrees
// 3.1415926535897931

Float.pi.radians
// 180

✓ Converter functions

deg2rad(90)
// 1.5707963267948966

rad2deg/ 2)
// 90

rec2pol(x: 0, y: 1)
// (r = 1, θ = 1.5707963267948966)

pol2rec(r: 1, θ: 90°)
// (x = 0, y = 1)

✓ Fancy unicode degree symbol postfix operator (if you're into that kind of thing)

45°
// 0.78539816339744828