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 | Haskell2010 |
Linear.V4
Description
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.
Constructors
V4 !a !a !a !a |
Instances
Monad V4 Source # | |
Functor V4 Source # | |
MonadFix V4 Source # | |
Applicative V4 Source # | |
Foldable V4 Source # | |
Defined in Linear.V4 Methods foldMap :: Monoid m => (a -> m) -> V4 a -> m foldMap' :: Monoid m => (a -> m) -> V4 a -> m foldr :: (a -> b -> b) -> b -> V4 a -> b foldr' :: (a -> b -> b) -> b -> V4 a -> b foldl :: (b -> a -> b) -> b -> V4 a -> b foldl' :: (b -> a -> b) -> b -> V4 a -> b foldr1 :: (a -> a -> a) -> V4 a -> a foldl1 :: (a -> a -> a) -> V4 a -> a | |
Traversable V4 Source # | |
Distributive V4 Source # | |
Representable V4 Source # | |
Show1 V4 Source # | |
Defined in Linear.V4 Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> V4 a -> ShowS liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [V4 a] -> ShowS | |
Read1 V4 Source # | |
Defined in Linear.V4 Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (V4 a) liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [V4 a] liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (V4 a) liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [V4 a] | |
Ord1 V4 Source # | |
Defined in Linear.V4 Methods liftCompare :: (a -> b -> Ordering) -> V4 a -> V4 b -> Ordering | |
Eq1 V4 Source # | |
MonadZip V4 Source # | |
Serial1 V4 Source # | |
Hashable1 V4 Source # | |
Defined in Linear.V4 Methods liftHashWithSalt :: (Int -> a -> Int) -> Int -> V4 a -> Int Source # | |
Apply V4 Source # | |
Traversable1 V4 Source # | |
Foldable1 V4 Source # | |
Bind V4 Source # | |
Additive V4 Source # | |
Defined in Linear.V4 | |
Metric V4 Source # | |
Finite V4 Source # | |
R1 V4 Source # | |
R2 V4 Source # | |
R3 V4 Source # | |
R4 V4 Source # | |
Trace V4 Source # | |
Affine V4 Source # | |
Unbox a => Vector Vector (V4 a) Source # | |
Defined in Linear.V4 Methods basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (V4 a) -> m (Vector (V4 a)) Source # basicUnsafeThaw :: PrimMonad m => Vector (V4 a) -> m (Mutable Vector (PrimState m) (V4 a)) Source # basicLength :: Vector (V4 a) -> Int Source # basicUnsafeSlice :: Int -> Int -> Vector (V4 a) -> Vector (V4 a) Source # basicUnsafeIndexM :: Monad m => Vector (V4 a) -> Int -> m (V4 a) Source # basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (V4 a) -> Vector (V4 a) -> m () Source # | |
Unbox a => MVector MVector (V4 a) Source # | |
Defined in Linear.V4 Methods basicLength :: MVector s (V4 a) -> Int Source # basicUnsafeSlice :: Int -> Int -> MVector s (V4 a) -> MVector s (V4 a) Source # basicOverlaps :: MVector s (V4 a) -> MVector s (V4 a) -> Bool Source # basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (V4 a)) Source # basicInitialize :: PrimMonad m => MVector (PrimState m) (V4 a) -> m () Source # basicUnsafeReplicate :: PrimMonad m => Int -> V4 a -> m (MVector (PrimState m) (V4 a)) Source # basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (V4 a) -> Int -> m (V4 a) Source # basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (V4 a) -> Int -> V4 a -> m () Source # basicClear :: PrimMonad m => MVector (PrimState m) (V4 a) -> m () Source # basicSet :: PrimMonad m => MVector (PrimState m) (V4 a) -> V4 a -> m () Source # basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (V4 a) -> MVector (PrimState m) (V4 a) -> m () Source # basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (V4 a) -> MVector (PrimState m) (V4 a) -> m () Source # basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (V4 a) -> Int -> m (MVector (PrimState m) (V4 a)) Source # | |
Num r => Coalgebra r (E V4) Source # | |
Bounded a => Bounded (V4 a) Source # | |
Eq a => Eq (V4 a) Source # | |
Floating a => Floating (V4 a) Source # | |
Fractional a => Fractional (V4 a) Source # | |
Data a => Data (V4 a) Source # | |
Defined in Linear.V4 Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> V4 a -> c (V4 a) gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (V4 a) dataTypeOf :: V4 a -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (V4 a)) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V4 a)) gmapT :: (forall b. Data b => b -> b) -> V4 a -> V4 a gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V4 a -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V4 a -> r gmapQ :: (forall d. Data d => d -> u) -> V4 a -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> V4 a -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> V4 a -> m (V4 a) gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> V4 a -> m (V4 a) gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> V4 a -> m (V4 a) | |
Num a => Num (V4 a) Source # | |
Ord a => Ord (V4 a) Source # | |
Read a => Read (V4 a) Source # | |
Show a => Show (V4 a) Source # | |
Ix a => Ix (V4 a) Source # | |
Generic (V4 a) Source # | |
Semigroup a => Semigroup (V4 a) Source # | |
Monoid a => Monoid (V4 a) Source # | |
Lift a => Lift (V4 a) Source # | |
Storable a => Storable (V4 a) Source # | |
Defined in Linear.V4 | |
Serial a => Serial (V4 a) Source # | |
Serialize a => Serialize (V4 a) Source # | |
Hashable a => Hashable (V4 a) Source # | |
Unbox a => Unbox (V4 a) Source # | |
Defined in Linear.V4 | |
Ixed (V4 a) Source # | |
Random a => Random (V4 a) Source # | |
Binary a => Binary (V4 a) Source # | |
NFData a => NFData (V4 a) Source # | |
Epsilon a => Epsilon (V4 a) Source # | |
Generic1 V4 Source # | |
FunctorWithIndex (E V4) V4 Source # | |
FoldableWithIndex (E V4) V4 Source # | |
Defined in Linear.V4 | |
TraversableWithIndex (E V4) V4 Source # | |
Each (V4 a) (V4 b) a b Source # | |
Field1 (V4 a) (V4 a) a a Source # | |
Field2 (V4 a) (V4 a) a a Source # | |
Field3 (V4 a) (V4 a) a a Source # | |
Field4 (V4 a) (V4 a) a a Source # | |
type Rep V4 Source # | |
type Size V4 Source # | |
type Diff V4 Source # | |
Defined in Linear.Affine | |
data MVector s (V4 a) Source # | |
type Rep (V4 a) Source # | |
Defined in Linear.V4 type Rep (V4 a) = D1 ('MetaData "V4" "Linear.V4" "linear-1.21.1-Bve2SeE5gRc99gN7T6JdXA" 'False) (C1 ('MetaCons "V4" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))) | |
data Vector (V4 a) Source # | |
type Index (V4 a) Source # | |
type IxValue (V4 a) Source # | |
type Rep1 V4 Source # | |
Defined in Linear.V4 type Rep1 V4 = D1 ('MetaData "V4" "Linear.V4" "linear-1.21.1-Bve2SeE5gRc99gN7T6JdXA" 'False) (C1 ('MetaCons "V4" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1))) |
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 #
Minimal complete definition
Methods
>>>
V2 1 2 ^._y
2
>>>
V2 1 2 & _y .~ 3
V2 1 3