linear-1.20.3: Linear Algebra

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

Linear.V3

Description

3-D Vectors

Synopsis

- data V3 a = V3 !a !a !a
- cross :: Num a => V3 a -> V3 a -> V3 a
- triple :: Num a => V3 a -> V3 a -> V3 a -> a
- class R1 t where
  - _x :: Lens' (t a) a
- class R1 t => R2 t where
  - _y :: Lens' (t a) a
  - _xy :: Lens' (t a) (V2 a)
- _yx :: R2 t => Lens' (t a) (V2 a)
- class R2 t => R3 t where
  - _z :: Lens' (t a) a
  - _xyz :: Lens' (t a) (V3 a)
- _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)
- ex :: R1 t => E t
- ey :: R2 t => E t
- ez :: R3 t => E t

# Documentation

data V3 a Source

A 3-dimensional vector

Constructors

V3 !a !a !a |

Instances

Monad V3 Source |
Functor V3 Source |
MonadFix V3 Source |
Applicative V3 Source |
Foldable V3 Source |
Traversable V3 Source |
Generic1 V3 Source |
Distributive V3 Source |
Representable V3 Source |
MonadZip V3 Source |
Serial1 V3 Source |
Traversable1 V3 Source |
Apply V3 Source |
Bind V3 Source |
Foldable1 V3 Source |
Eq1 V3 Source |
Ord1 V3 Source |
Read1 V3 Source |
Show1 V3 Source |
Additive V3 Source |
Metric V3 Source |
R1 V3 Source |
R2 V3 Source |
R3 V3 Source |
Trace V3 Source |
Affine V3 Source |
Unbox a => Vector Vector (V3 a) Source |
Unbox a => MVector MVector (V3 a) Source |
Num r => Coalgebra r (E V3) Source |
Bounded a => Bounded (V3 a) Source |
Eq a => Eq (V3 a) Source |
Floating a => Floating (V3 a) Source |
Fractional a => Fractional (V3 a) Source |
Data a => Data (V3 a) Source |
Num a => Num (V3 a) Source |
Ord a => Ord (V3 a) Source |
Read a => Read (V3 a) Source |
Show a => Show (V3 a) Source |
Ix a => Ix (V3 a) Source |
Generic (V3 a) Source |
Storable a => Storable (V3 a) Source |
Binary a => Binary (V3 a) Source |
Serial a => Serial (V3 a) Source |
Serialize a => Serialize (V3 a) Source |
NFData a => NFData (V3 a) Source |
Hashable a => Hashable (V3 a) Source |
Unbox a => Unbox (V3 a) Source |
Ixed (V3 a) Source |
Epsilon a => Epsilon (V3 a) Source |
FunctorWithIndex (E V3) V3 Source |
FoldableWithIndex (E V3) V3 Source |
TraversableWithIndex (E V3) V3 Source |
Each (V3 a) (V3 b) a b Source |
type Rep1 V3 Source |
type Rep V3 = E V3 Source |
type Diff V3 = V3 Source |
data MVector s (V3 a) = MV_V3 !Int !(MVector s a) Source |
type Rep (V3 a) Source |
data Vector (V3 a) = V_V3 !Int !(Vector a) Source |
type Index (V3 a) = E V3 Source |
type IxValue (V3 a) = a Source |

cross :: Num a => V3 a -> V3 a -> V3 a Source

cross product

triple :: Num a => V3 a -> V3 a -> V3 a -> a Source

scalar triple product

class R1 t where Source

A space that has at least 1 basis vector `_x`.

Minimal complete definition

Nothing

Methods

_x :: Lens' (t a) a Source

    >>> V1 2 ^._x
    2

    >>> V1 2 & _x .~ 3
    V1 3

Instances

R1 Identity Source |
R1 V1 Source |
R1 V2 Source |
R1 V3 Source |
R1 V4 Source |
R1 f => R1 (Point f) Source |

class R1 t => R2 t where Source

A space that distinguishes 2 orthogonal basis vectors `_x` and `_y`, but may have more.

Minimal complete definition

Nothing

Methods

_y :: Lens' (t a) a Source

    >>> V2 1 2 ^._y
    2

    >>> V2 1 2 & _y .~ 3
    V2 1 3

_xy :: Lens' (t a) (V2 a) Source

Instances

R2 V2 Source |
R2 V3 Source |
R2 V4 Source |
R2 f => R2 (Point f) Source |

_yx :: R2 t => Lens' (t a) (V2 a) Source

    >>> V2 1 2 ^. _yx
    V2 2 1

class R2 t => R3 t where Source

A space that distinguishes 3 orthogonal basis vectors: `_x`, `_y`, and `_z`. (It may have more)

Minimal complete definition

Nothing

Methods

_z :: Lens' (t a) a Source

    >>> V3 1 2 3 ^. _z
    3

_xyz :: Lens' (t a) (V3 a) Source

Instances

R3 V3 Source |
R3 V4 Source |
R3 f => R3 (Point f) Source |

_xz :: R3 t => Lens' (t a) (V2 a) Source

_yz :: R3 t => Lens' (t a) (V2 a) Source

_zx :: R3 t => Lens' (t a) (V2 a) Source

_zy :: R3 t => Lens' (t a) (V2 a) Source

_xzy :: R3 t => Lens' (t a) (V3 a) Source

_yxz :: R3 t => Lens' (t a) (V3 a) Source

_yzx :: R3 t => Lens' (t a) (V3 a) Source

_zxy :: R3 t => Lens' (t a) (V3 a) Source

_zyx :: R3 t => Lens' (t a) (V3 a) Source

ex :: R1 t => E t Source

ey :: R2 t => E t Source

ez :: R3 t => E t Source