AC-Vector-Fancy-2.2.0: Fancy type-system stuff for AC-Vector




Various facilities for dealing with vectors, vector spaces and coordinate axies generically.


Vector spaces

class HasSpace x Source

This class deals with any type that has a spatial dimensionallity. This includes coordinate transforms, bounding boxes, and so on.

Null instances are provided for all the vector types. (E.g., Point Vector3 = Vector3.)

Associated Types

type Point x :: *Source

Give the appropriate kind of vector for this type.

Vector axies

class VectorAxis vector axis whereSource

Class for generically reading/writing vector coordinates.


get_coord :: axis -> vector -> ScalarSource

Read from the specified coordinate axis.

set_coord :: axis -> Scalar -> vector -> vectorSource

Replace the existing value of the given coordinate axis.

class Project lo hi whereSource

This class relates two vector types having consecutive sizes.


orthographic_down :: hi -> (lo, Scalar)Source

Reduce number of dimensions by one. (Return the dropped dimension as a Scalar.)

orthographic_up :: (lo, Scalar) -> hiSource

Increase number of dimensions by one. (Supply value for new dimension as a Scalar.)

perspective_down :: hi -> (lo, Scalar)Source

Perspective-project to N-1 dimensions. (Also return the distance from the camera as a Scalar.)

perspective_up :: (lo, Scalar) -> hiSource

Inverse-perspective project into N+1 dimension. (Supply the distance from the camera as a Scalar.)