linear-1.3.1: Linear Algebra

Portabilitynon-portable
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellTrustworthy

Linear.V4

Description

4-D Vectors

Synopsis

Documentation

data V4 a Source

A 4-dimensional vector.

Constructors

V4 !a !a !a !a 

Instances

Monad V4 
Functor V4 
Typeable1 V4 
Applicative V4 
Foldable V4 
Traversable V4 
Distributive V4 
Traversable1 V4 
Foldable1 V4 
Apply V4 
Bind V4 
Additive V4 
Metric V4 
Core V4 
R1 V4 
R2 V4 
R3 V4 
R4 V4 
Trace V4 
Affine V4 
Eq a => Eq (V4 a) 
Fractional a => Fractional (V4 a) 
Data a => Data (V4 a) 
Num a => Num (V4 a) 
Ord a => Ord (V4 a) 
Read a => Read (V4 a) 
Show a => Show (V4 a) 
Ix a => Ix (V4 a) 
Storable a => Storable (V4 a) 
Epsilon a => Epsilon (V4 a) 

vector :: Num a => V3 a -> V4 aSource

Convert a 3-dimensional affine vector into a 4-dimensional homogeneous vector.

point :: Num a => V3 a -> V4 aSource

Convert a 3-dimensional affine point into a 4-dimensional homogeneous vector.

normalizePoint :: Fractional a => V4 a -> V3 aSource

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).

class R1 t whereSource

A space that has at least 1 basis vector _x.

Methods

_x :: Functor f => (a -> f a) -> t a -> f (t a)Source

>>> V1 2 ^._x
2
>>> V1 2 & _x .~ 3
V1 3
 _x :: Lens' (t a) a

Instances

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

class R1 t => R2 t whereSource

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

Methods

_y :: Functor f => (a -> f a) -> t a -> f (t a)Source

>>> V2 1 2 ^._y
2
>>> V2 1 2 & _y .~ 3
V2 1 3
 _y :: Lens' (t a) a

_xy :: Functor f => (V2 a -> f (V2 a)) -> t a -> f (t a)Source

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

Instances

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

class R2 t => R3 t whereSource

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

Methods

_z :: Functor f => (a -> f a) -> t a -> f (t a)Source

 _z :: Lens' (t a) a

_xyz :: Functor f => (V3 a -> f (V3 a)) -> t a -> f (t a)Source

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

Instances

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

class R3 t => R4 t whereSource

A space that distinguishes orthogonal basis vectors _x, _y, _z, _w. (It may have more.)

Methods

_w :: Functor f => (a -> f a) -> t a -> f (t a)Source

 _w :: Lens' (t a) a

_xyzw :: Functor f => (V4 a -> f (V4 a)) -> t a -> f (t a)Source

 _xyzw :: Lens' (t a) (V4 a)

Instances

R4 V4 
R4 f => R4 (Point f)