HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulelinear-1.22Haskell2010

Linear.V4

4-D Vectors

  • 1 type
  • 4 classes
  • 64 values
  • Packagelinear-1.22
  • Exports69
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceV4.hs
datadata V4 a
#

A 4-dimensional vector.

Constructors

  • V4 !a !a !a !a
Instances73Monad, Functor, MonadFix, Applicative, Foldable, Traversable, …
valuevector :: Num a => V3 a -> V4 a
#

Convert a 3-dimensional affine vector into a 4-dimensional homogeneous vector, i.e. sets the w coordinate to 0.

valuepoint :: Num a => V3 a -> V4 a
#

Convert a 3-dimensional affine point into a 4-dimensional homogeneous vector, i.e. sets the w coordinate to 1.

valuenormalizePoint :: Fractional a => V4 a -> V3 a
#

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

classclass R1 (t :: Type -> Type) where
#

A space that has at least 1 basis vector _x.

Methods

  • _x :: Lens' (t a) a
    Example1 expression
    V1 2 ^._x2
    Example1 expression
    V1 2 & _x .~ 3V1 3
Instances7R1, …
  • R1 IdentityDefined in linear-1.22 · Linear.V1
  • R1 QuaternionDefined in linear-1.22 · Linear.Quaternion
  • R1 V1Defined in linear-1.22 · Linear.V1
  • R1 V2Defined in linear-1.22 · Linear.V2
  • R1 V3Defined in linear-1.22 · Linear.V3
  • R1 V4Defined in linear-1.22 · Linear.V4
  • R1 f => R1 (Point f)Defined in linear-1.22 · Linear.Affine
classclass R1 t => R2 (t :: Type -> Type) where
#

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

Methods

  • _y :: Lens' (t a) a
    Example1 expression
    V2 1 2 ^._y2
    Example1 expression
    V2 1 2 & _y .~ 3V2 1 3
  • _xy :: Lens' (t a) (V2 a)
Instances5R2
  • R2 QuaternionDefined in linear-1.22 · Linear.Quaternion
  • R2 V2Defined in linear-1.22 · Linear.V2
  • R2 V3Defined in linear-1.22 · Linear.V3
  • R2 V4Defined in linear-1.22 · Linear.V4
  • R2 f => R2 (Point f)Defined in linear-1.22 · Linear.Affine
value_yx :: R2 t => Lens' (t a) (V2 a)
#
Example1 expression
V2 1 2 ^. _yxV2 2 1
classclass R2 t => R3 (t :: Type -> Type) where
#

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

Methods

Instances4R3
  • R3 QuaternionDefined in linear-1.22 · Linear.Quaternion
  • R3 V3Defined in linear-1.22 · Linear.V3
  • R3 V4Defined in linear-1.22 · Linear.V4
  • R3 f => R3 (Point f)Defined in linear-1.22 · Linear.Affine
classclass R3 t => R4 (t :: Type -> Type) where
#

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

Methods

Instances3R4
  • R4 QuaternionDefined in linear-1.22 · Linear.Quaternion
  • R4 V4Defined in linear-1.22 · Linear.V4
  • R4 f => R4 (Point f)Defined in linear-1.22 · Linear.Affine