Copyright | (C) 2012-2015 Edward Kmett |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Edward Kmett <[email protected]> |
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
Representable V4 Source # | |
MonadFix V4 Source # | |
MonadZip V4 Source # | |
Foldable V4 Source # | |
Defined in Linear.V4 Methods fold :: Monoid m => V4 m -> m # 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 # elem :: Eq a => a -> V4 a -> Bool # maximum :: Ord a => V4 a -> a # | |
Foldable1 V4 Source # | |
Defined in Linear.V4 Methods fold1 :: Semigroup m => V4 m -> m # foldMap1 :: Semigroup m => (a -> m) -> V4 a -> m # foldMap1' :: Semigroup m => (a -> m) -> V4 a -> m # toNonEmpty :: V4 a -> NonEmpty a # maximum :: Ord a => V4 a -> a # minimum :: Ord a => V4 a -> a # foldrMap1 :: (a -> b) -> (a -> b -> b) -> V4 a -> b # foldlMap1' :: (a -> b) -> (b -> a -> b) -> V4 a -> b # foldlMap1 :: (a -> b) -> (b -> a -> b) -> V4 a -> b # foldrMap1' :: (a -> b) -> (a -> b -> b) -> V4 a -> b # | |
Eq1 V4 Source # | |
Ord1 V4 Source # | |
Read1 V4 Source # | |
Show1 V4 Source # | |
Traversable V4 Source # | |
Applicative V4 Source # | |
Functor V4 Source # | |
Monad V4 Source # | |
Serial1 V4 Source # | |
Defined in Linear.V4 Methods serializeWith :: MonadPut m => (a -> m ()) -> V4 a -> m () # deserializeWith :: MonadGet m => m a -> m (V4 a) # | |
Distributive V4 Source # | |
Hashable1 V4 Source # | |
Affine V4 Source # | |
Metric V4 Source # | |
Trace V4 Source # | |
Finite V4 Source # | |
R1 V4 Source # | |
R2 V4 Source # | |
R3 V4 Source # | |
R4 V4 Source # | |
Additive V4 Source # | |
Defined in Linear.V4 | |
Apply V4 Source # | |
Bind V4 Source # | |
Traversable1 V4 Source # | |
Generic1 V4 Source # | |
Num r => Coalgebra r (E V4) Source # | |
Lift a => Lift (V4 a :: Type) Source # | |
Unbox a => Vector Vector (V4 a) Source # | |
Defined in Linear.V4 Methods basicUnsafeFreeze :: Mutable Vector s (V4 a) -> ST s (Vector (V4 a)) basicUnsafeThaw :: Vector (V4 a) -> ST s (Mutable Vector s (V4 a)) basicLength :: Vector (V4 a) -> Int basicUnsafeSlice :: Int -> Int -> Vector (V4 a) -> Vector (V4 a) basicUnsafeIndexM :: Vector (V4 a) -> Int -> Box (V4 a) basicUnsafeCopy :: Mutable Vector s (V4 a) -> Vector (V4 a) -> ST s () | |
Unbox a => MVector MVector (V4 a) Source # | |
Defined in Linear.V4 Methods basicLength :: MVector s (V4 a) -> Int basicUnsafeSlice :: Int -> Int -> MVector s (V4 a) -> MVector s (V4 a) basicOverlaps :: MVector s (V4 a) -> MVector s (V4 a) -> Bool basicUnsafeNew :: Int -> ST s (MVector s (V4 a)) basicInitialize :: MVector s (V4 a) -> ST s () basicUnsafeReplicate :: Int -> V4 a -> ST s (MVector s (V4 a)) basicUnsafeRead :: MVector s (V4 a) -> Int -> ST s (V4 a) basicUnsafeWrite :: MVector s (V4 a) -> Int -> V4 a -> ST s () basicClear :: MVector s (V4 a) -> ST s () basicSet :: MVector s (V4 a) -> V4 a -> ST s () basicUnsafeCopy :: MVector s (V4 a) -> MVector s (V4 a) -> ST s () basicUnsafeMove :: MVector s (V4 a) -> MVector s (V4 a) -> ST s () basicUnsafeGrow :: MVector s (V4 a) -> Int -> ST s (MVector s (V4 a)) | |
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) # | |
Storable a => Storable (V4 a) Source # | |
Monoid a => Monoid (V4 a) Source # | |
Semigroup a => Semigroup (V4 a) Source # | |
Bounded a => Bounded (V4 a) Source # | |
Floating a => Floating (V4 a) Source # | |
Generic (V4 a) Source # | |
Ix a => Ix (V4 a) Source # | |
Num a => Num (V4 a) Source # | |
Read a => Read (V4 a) Source # | |
Fractional a => Fractional (V4 a) Source # | |
Show a => Show (V4 a) Source # | |
Binary a => Binary (V4 a) Source # | |
Serial a => Serial (V4 a) Source # | |
Serialize a => Serialize (V4 a) Source # | |
NFData a => NFData (V4 a) Source # | |
Eq a => Eq (V4 a) Source # | |
Ord a => Ord (V4 a) Source # | |
Hashable a => Hashable (V4 a) Source # | |
Ixed (V4 a) Source # | |
Epsilon a => Epsilon (V4 a) Source # | |
Random a => Random (V4 a) Source # | |
Uniform a => Uniform (V4 a) Source # | |
Defined in Linear.V4 Methods uniformM :: StatefulGen g m => g -> m (V4 a) # | |
UniformRange a => UniformRange (V4 a) Source # | |
Unbox a => Unbox (V4 a) Source # | |
Defined in Linear.V4 | |
FoldableWithIndex (E V4) V4 Source # | |
FunctorWithIndex (E V4) V4 Source # | |
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 Diff V4 Source # | |
Defined in Linear.Affine | |
type Size V4 Source # | |
type Rep1 V4 Source # | |
Defined in Linear.V4 type Rep1 V4 = D1 ('MetaData "V4" "Linear.V4" "linear-1.23.1-3KxQuVTaEbf7IVom2f7XaL" '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))) | |
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.23.1-3KxQuVTaEbf7IVom2f7XaL" '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)))) | |
type Index (V4 a) Source # | |
type IxValue (V4 a) Source # | |
data Vector (V4 a) Source # | |
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