Maintainer | diagrams-discuss@googlegroups.com |
---|---|

Safe Haskell | None |

Type for representing angles, independent of vector-space

- data Angle
- rad :: Iso' Angle Double
- turn :: Iso' Angle Double
- deg :: Iso' Angle Double
- fullTurn :: Angle
- fullCircle :: Angle
- angleRatio :: Angle -> Angle -> Double
- sinA :: Angle -> Double
- cosA :: Angle -> Double
- tanA :: Angle -> Double
- asinA :: Double -> Angle
- acosA :: Double -> Angle
- atanA :: Double -> Angle
- (@@) :: b -> Iso' a b -> a
- angleBetween :: (InnerSpace v, Scalar v ~ Double) => v -> v -> Angle
- class HasTheta t where

# Documentation

Angles can be expressed in a variety of units. Internally, they are represented in radians.

rad :: Iso' Angle DoubleSource

The radian measure of an `Angle`

`a`

can be accessed as ```
a
^. rad
```

. A new `Angle`

can be defined in radians as `pi @@ rad`

.

turn :: Iso' Angle DoubleSource

The measure of an `Angle`

`a`

in full circles can be accessed as
`a ^. turn`

. A new `Angle`

of one-half circle can be defined in as
`1/2 @@ turn`

.

deg :: Iso' Angle DoubleSource

The degree measure of an `Angle`

`a`

can be accessed as ```
a
^. deg
```

. A new `Angle`

can be defined in degrees as ```
180 @@
deg
```

.

Deprecated synonym for `fullTurn`

, retained for backwards compatibility.

angleRatio :: Angle -> Angle -> DoubleSource

Calculate ratio between two angles.

(@@) :: b -> Iso' a b -> aSource

`30 @@ deg`

is an `Angle`

of the given measure and units.

More generally, `@@`

reverses the `Iso'`

on its right, and
applies the `Iso'`

to the value on the left. `Angle`

s are the
motivating example where this order improves readability.

angleBetween :: (InnerSpace v, Scalar v ~ Double) => v -> v -> AngleSource

compute the positive angle between the two vectors in their common plane