Portability | non-portable (GHC extensions) |
---|---|

Stability | provisional |

Maintainer | nilsson@cs.yale.edu |

2D vector abstraction (R^2).

ToDo: Deriving Show, or provide dedicated show instance?

- data RealFloat a => Vector2 a
- vector2 :: RealFloat a => a -> a -> Vector2 a
- vector2X :: RealFloat a => Vector2 a -> a
- vector2Y :: RealFloat a => Vector2 a -> a
- vector2XY :: RealFloat a => Vector2 a -> (a, a)
- vector2Polar :: RealFloat a => a -> a -> Vector2 a
- vector2Rho :: RealFloat a => Vector2 a -> a
- vector2Theta :: RealFloat a => Vector2 a -> a
- vector2RhoTheta :: RealFloat a => Vector2 a -> (a, a)
- vector2Rotate :: RealFloat a => a -> Vector2 a -> Vector2 a

# Documentation

Create a 2D vector

Obtain the X-magnitude of a vector

vector2Y :: RealFloat a => Vector2 a -> aSource

Obtain the X and Y magnitudes of a vector as an ordered pair

Create a vector from polar coordinates (magnitude*rho, direction*theta (radians))

Obtain the magnitude of a vector

vector2Rho :: RealFloat a => Vector2 a -> aSource

Obtain the direction of a vector

vector2Theta :: RealFloat a => Vector2 a -> aSource

Obtain the magnitude and direction of a vector as an ordered pair