gloss- Painless 2D vector graphics, animations and simulations.

Safe HaskellSafe-Infered



Geometric functions concerning vectors.



type Vector = PointSource

A vector can be treated as a point, and vis-versa.

magV :: Vector -> FloatSource

The magnitude of a vector.

argV :: Vector -> FloatSource

The angle of this vector, relative to the +ve x-axis.

dotV :: Vector -> Vector -> FloatSource

The dot product of two vectors.

detV :: Vector -> Vector -> FloatSource

The determinant of two vectors.

mulSV :: Float -> Vector -> VectorSource

Multiply a vector by a scalar.

rotateV :: Float -> Vector -> VectorSource

Rotate a vector by an angle (in radians). +ve angle is counter-clockwise.

angleVV :: Vector -> Vector -> FloatSource

Compute the inner angle (in radians) between two vectors.

normaliseV :: Vector -> VectorSource

Normalise a vector, so it has a magnitude of 1.

unitVectorAtAngle :: Float -> VectorSource

Produce a unit vector at a given angle relative to the +ve x-axis. The provided angle is in radians.