Copyright | (C) 2012-2015 Edward Kmett |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Trustworthy |
Language | Haskell98 |
4-D Vectors
Synopsis
- data V4 a = V4 !a !a !a !a
- vector :: Num a => V3 a -> V4 a
- point :: Num a => V3 a -> V4 a
- normalizePoint :: Fractional a => V4 a -> V3 a
- class R1 t where
- class R1 t => R2 t where
- _yx :: R2 t => Lens' (t a) (V2 a)
- class R2 t => R3 t where
- _xz :: R3 t => Lens' (t a) (V2 a)
- _yz :: R3 t => Lens' (t a) (V2 a)
- _zx :: R3 t => Lens' (t a) (V2 a)
- _zy :: R3 t => Lens' (t a) (V2 a)
- _xzy :: R3 t => Lens' (t a) (V3 a)
- _yxz :: R3 t => Lens' (t a) (V3 a)
- _yzx :: R3 t => Lens' (t a) (V3 a)
- _zxy :: R3 t => Lens' (t a) (V3 a)
- _zyx :: R3 t => Lens' (t a) (V3 a)
- class R3 t => R4 t where
- _xw :: R4 t => Lens' (t a) (V2 a)
- _yw :: R4 t => Lens' (t a) (V2 a)
- _zw :: R4 t => Lens' (t a) (V2 a)
- _wx :: R4 t => Lens' (t a) (V2 a)
- _wy :: R4 t => Lens' (t a) (V2 a)
- _wz :: R4 t => Lens' (t a) (V2 a)
- _xyw :: R4 t => Lens' (t a) (V3 a)
- _xzw :: R4 t => Lens' (t a) (V3 a)
- _xwy :: R4 t => Lens' (t a) (V3 a)
- _xwz :: R4 t => Lens' (t a) (V3 a)
- _yxw :: R4 t => Lens' (t a) (V3 a)
- _yzw :: R4 t => Lens' (t a) (V3 a)
- _ywx :: R4 t => Lens' (t a) (V3 a)
- _ywz :: R4 t => Lens' (t a) (V3 a)
- _zxw :: R4 t => Lens' (t a) (V3 a)
- _zyw :: R4 t => Lens' (t a) (V3 a)
- _zwx :: R4 t => Lens' (t a) (V3 a)
- _zwy :: R4 t => Lens' (t a) (V3 a)
- _wxy :: R4 t => Lens' (t a) (V3 a)
- _wxz :: R4 t => Lens' (t a) (V3 a)
- _wyx :: R4 t => Lens' (t a) (V3 a)
- _wyz :: R4 t => Lens' (t a) (V3 a)
- _wzx :: R4 t => Lens' (t a) (V3 a)
- _wzy :: R4 t => Lens' (t a) (V3 a)
- _xywz :: R4 t => Lens' (t a) (V4 a)
- _xzyw :: R4 t => Lens' (t a) (V4 a)
- _xzwy :: R4 t => Lens' (t a) (V4 a)
- _xwyz :: R4 t => Lens' (t a) (V4 a)
- _xwzy :: R4 t => Lens' (t a) (V4 a)
- _yxzw :: R4 t => Lens' (t a) (V4 a)
- _yxwz :: R4 t => Lens' (t a) (V4 a)
- _yzxw :: R4 t => Lens' (t a) (V4 a)
- _yzwx :: R4 t => Lens' (t a) (V4 a)
- _ywxz :: R4 t => Lens' (t a) (V4 a)
- _ywzx :: R4 t => Lens' (t a) (V4 a)
- _zxyw :: R4 t => Lens' (t a) (V4 a)
- _zxwy :: R4 t => Lens' (t a) (V4 a)
- _zyxw :: R4 t => Lens' (t a) (V4 a)
- _zywx :: R4 t => Lens' (t a) (V4 a)
- _zwxy :: R4 t => Lens' (t a) (V4 a)
- _zwyx :: R4 t => Lens' (t a) (V4 a)
- _wxyz :: R4 t => Lens' (t a) (V4 a)
- _wxzy :: R4 t => Lens' (t a) (V4 a)
- _wyxz :: R4 t => Lens' (t a) (V4 a)
- _wyzx :: R4 t => Lens' (t a) (V4 a)
- _wzxy :: R4 t => Lens' (t a) (V4 a)
- _wzyx :: R4 t => Lens' (t a) (V4 a)
- ex :: R1 t => E t
- ey :: R2 t => E t
- ez :: R3 t => E t
- ew :: R4 t => E t
Documentation
A 4-dimensional vector.
V4 !a !a !a !a |
Instances
vector :: Num a => V3 a -> V4 a Source #
Convert a 3-dimensional affine vector into a 4-dimensional homogeneous vector,
i.e. sets the w
coordinate to 0.
point :: Num a => V3 a -> V4 a Source #
Convert a 3-dimensional affine point into a 4-dimensional homogeneous vector,
i.e. sets the w
coordinate to 1.
normalizePoint :: Fractional a => V4 a -> V3 a Source #
Convert 4-dimensional projective coordinates to a 3-dimensional
point. This operation may be denoted, euclidean [x:y:z:w] = (x/w,
y/w, z/w)
where the projective, homogenous, coordinate
[x:y:z:w]
is one of many associated with a single point (x/w,
y/w, z/w)
.
A space that has at least 1 basis vector _x
.
class R1 t => R2 t where Source #
>>>
V2 1 2 ^._y
2
>>>
V2 1 2 & _y .~ 3
V2 1 3