Copyright | (c) 2011 diagrams-lib team (see LICENSE) |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | diagrams-discuss@googlegroups.com |
Safe Haskell | None |
Language | Haskell2010 |
Two-dimensional vectors.
Special 2D vectors
Converting between vectors and angles
direction :: R2 -> Angle Source
Compute the direction of a vector, measured counterclockwise from the positive x-axis as a fraction of a full turn. The zero vector is arbitrarily assigned the direction 0.
angleBetween :: R2 -> R2 -> Angle Source
Compute the counterclockwise angle from the first vector to the second.
fromDirection :: Angle -> R2 Source
Convert an angle into a unit vector pointing in that direction.
A convenient synonym for fromDirection
.
2D vector utilities
perp v
is perpendicular to and has the same magnitude as v
.
In particular perp v == rotateBy (1/4) v
.