Copyright | 2014 Edward Kmett Charles Durham [2015..2020] Trevor L. McDonell |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Trevor L. McDonell <trevor.mcdonell@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
3-D Vectors
Synopsis
- data V3 a = V3 !a !a !a
- pattern V3_ :: Elt a => Exp a -> Exp a -> Exp a -> Exp (V3 a)
- cross :: forall a. Num a => Exp (V3 a) -> Exp (V3 a) -> Exp (V3 a)
- triple :: forall a. Num a => Exp (V3 a) -> Exp (V3 a) -> Exp (V3 a) -> Exp a
- class R1 t => R1 t where
- class (R2 t, R1 t) => R2 t where
- _yx :: forall t a. (R2 t, Elt a, Box t a) => Lens' (Exp (t a)) (Exp (V2 a))
- class (R3 t, R2 t) => R3 t where
- _xz :: forall t a. (R3 t, Elt a, Box t a) => Lens' (Exp (t a)) (Exp (V2 a))
- _yz :: forall t a. (R3 t, Elt a, Box t a) => Lens' (Exp (t a)) (Exp (V2 a))
- _zx :: forall t a. (R3 t, Elt a, Box t a) => Lens' (Exp (t a)) (Exp (V2 a))
- _zy :: forall t a. (R3 t, Elt a, Box t a) => Lens' (Exp (t a)) (Exp (V2 a))
- _xzy :: forall t a. (R3 t, Elt a, Box t a) => Lens' (Exp (t a)) (Exp (V3 a))
- _yxz :: forall t a. (R3 t, Elt a, Box t a) => Lens' (Exp (t a)) (Exp (V3 a))
- _yzx :: forall t a. (R3 t, Elt a, Box t a) => Lens' (Exp (t a)) (Exp (V3 a))
- _zxy :: forall t a. (R3 t, Elt a, Box t a) => Lens' (Exp (t a)) (Exp (V3 a))
- _zyx :: forall t a. (R3 t, Elt a, Box t a) => Lens' (Exp (t a)) (Exp (V3 a))
- ex :: R1 t => E t
- ey :: R2 t => E t
- ez :: R3 t => E t
Documentation
A 3-dimensional vector
V3 !a !a !a |
Instances
triple :: forall a. Num a => Exp (V3 a) -> Exp (V3 a) -> Exp (V3 a) -> Exp a Source #
scalar triple product
class R1 t => R1 t where Source #
A space that has at least 1 basis vector _x
.
Nothing
_x :: (Elt a, Box t a) => Lens' (Exp (t a)) (Exp a) Source #
>>>
test $ (V1_ 2 :: Exp (V1 Int)) ^. _x
2
>>>
test $ (V1_ 2 :: Exp (V1 Int)) & _x .~ 3
V1 3
class (R2 t, R1 t) => R2 t where Source #
Nothing
_y :: (Elt a, Box t a) => Lens' (Exp (t a)) (Exp a) Source #
>>>
test $ (V2_ 1 2 :: Exp (V2 Int)) ^. _y
2
>>>
test $ (V2_ 1 2 :: Exp (V2 Int)) & _y .~ 3
V2 1 3
_xy :: (Elt a, Box t a) => Lens' (Exp (t a)) (Exp (V2 a)) Source #
_yx :: forall t a. (R2 t, Elt a, Box t a) => Lens' (Exp (t a)) (Exp (V2 a)) Source #
>>>
test $ (V2_ 1 2 :: Exp (V2 Int)) ^. _yx
V2 2 1
class (R3 t, R2 t) => R3 t where Source #
Nothing
_z :: forall a. (Elt a, Box t a) => Lens' (Exp (t a)) (Exp a) Source #
>>>
test $ (V3_ 1 2 3 :: Exp (V3 Int)) ^. _z
3
>>>
test $ (V3_ 1 2 3 :: Exp (V3 Int)) & _z .~ 42
V3 1 2 42
_xyz :: forall a. (Elt a, Box t a) => Lens' (Exp (t a)) (Exp (V3 a)) Source #