vector-space-0.5.6: Vector & affine spaces, linear maps, and derivatives (requires ghc 6.9 or better)




Affine spaces.



class AdditiveGroup (Diff p) => AffineSpace p whereSource

Associated Types

type Diff p Source

Associated vector space


(.-.) :: p -> p -> Diff pSource

Subtract points

(.+^) :: p -> Diff p -> pSource

Point plus vector

(.-^) :: AffineSpace p => p -> Diff p -> pSource

Point minus vector

distanceSq :: (AffineSpace p, v ~ Diff p, InnerSpace v) => p -> p -> Scalar vSource

Square of the distance between two points. Sometimes useful for efficiency. See also distance.

distance :: (AffineSpace p, v ~ Diff p, InnerSpace v, s ~ Scalar v, Floating (Scalar v)) => p -> p -> sSource

Distance between two points. See also distanceSq.

alerp :: (AffineSpace p, VectorSpace (Diff p)) => p -> p -> Scalar (Diff p) -> pSource

Affine linear interpolation. Varies from p to p' as s varies from 0 to 1. See also lerp (on vector spaces).