Copyright | (c) 2013 diagrams-lib team (see LICENSE) |
---|---|

License | BSD-style (see LICENSE) |

Maintainer | diagrams-discuss@googlegroups.com |

Safe Haskell | None |

Language | Haskell2010 |

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 Double Source

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 Double Source

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 Double Source

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 -> Double Source

Calculate ratio between two angles.

(@@) :: b -> Iso' a b -> a infixl 5 Source

`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 -> Angle Source

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