Various facilities for dealing with vectors, vector spaces and coordinate axies generically.
- class Vector (Point x) => HasSpace x where
- type Point x :: *
- data AxisX = AxisX
- data AxisY = AxisY
- data AxisZ = AxisZ
- data AxisW = AxisW
- class VectorAxis vector axis where
- class (Vector v, Vector (ProjectTo v)) => Project v where
- type ProjectTo v :: *
- orthographic_down :: ProjectTo v -> (v, Scalar)
- orthographic_up :: (v, Scalar) -> ProjectTo v
- perspective_down :: ProjectTo v -> (v, Scalar)
- perspective_up :: (v, Scalar) -> ProjectTo v
Vector spaces
class Vector (Point x) => 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
.)
Vector axies
The X-axis (first axis).
The Y-axis (second axis).
The Z-axis (third axis).
The W-axis (fourth axis).
class VectorAxis vector axis whereSource
Class for generically reading/writing vector coordinates.
Vector projection
class (Vector v, Vector (ProjectTo v)) => Project v whereSource
This class enables you to take a vector with N dimensions and project it into an N+1 dimensional space (and also take the inverse projection to get back again).
orthographic_down :: ProjectTo v -> (v, Scalar)Source
Reduce number of dimensions by one. (Return the dropped dimension as a Scalar
.)
orthographic_up :: (v, Scalar) -> ProjectTo vSource
Increase number of dimensions by one. (Supply value for new dimension as a Scalar
.)
perspective_down :: ProjectTo v -> (v, Scalar)Source
Perspective-project to N-1 dimensions. (Also return the distance from the camera as a Scalar
.)
perspective_up :: (v, Scalar) -> ProjectTo vSource
Inverse-perspective project into N+1 dimension. (Supply the distance from the camera as a Scalar
.)