vect-0.4.6: A low-dimensional linear algebra library, tailored to computer graphics.Source codeContentsIndex
Data.Vect.Float.Base
Synopsis
class AbelianGroup g where
(&+) :: g -> g -> g
(&-) :: g -> g -> g
neg :: g -> g
zero :: g
vecSum :: AbelianGroup g => [g] -> g
class MultSemiGroup r where
(.*.) :: r -> r -> r
one :: r
class (AbelianGroup r, MultSemiGroup r) => Ring r
semigroupProduct :: MultSemiGroup r => [r] -> r
class LeftModule r m where
lmul :: r -> m -> m
(*.) :: r -> m -> m
class RightModule m r where
rmul :: m -> r -> m
(.*) :: m -> r -> m
class AbelianGroup v => Vector v where
mapVec :: (Float -> Float) -> v -> v
scalarMul :: Float -> v -> v
(*&) :: Float -> v -> v
(&*) :: v -> Float -> v
class DotProd v where
(&.) :: v -> v -> Float
norm :: v -> Float
normsqr :: v -> Float
len :: v -> Float
lensqr :: v -> Float
dotprod :: v -> v -> Float
class CrossProd v where
crossprod :: v -> v -> v
(&^) :: v -> v -> v
normalize :: (Vector v, DotProd v) => v -> v
distance :: (Vector v, DotProd v) => v -> v -> Float
angle :: (Vector v, DotProd v) => v -> v -> Float
angle' :: (Vector v, UnitVector v u, DotProd v) => u -> u -> Float
class (Vector v, DotProd v) => UnitVector v u | v -> u, u -> v where
mkNormal :: v -> u
toNormalUnsafe :: v -> u
fromNormal :: u -> v
fromNormalRadius :: Float -> u -> v
class Pointwise v where
pointwise :: v -> v -> v
(&!) :: v -> v -> v
class Extend u v where
extendZero :: u -> v
extendWith :: Float -> u -> v
trim :: v -> u
class HasCoordinates v x | v -> x where
_1 :: v -> x
_2 :: v -> x
_3 :: v -> x
_4 :: v -> x
class Dimension a where
dim :: a -> Int
class Matrix m where
transpose :: m -> m
inverse :: m -> m
idmtx :: m
class Tensor t v | t -> v where
outer :: v -> v -> t
class Diagonal s t | t -> s where
diag :: s -> t
class Determinant m where
det :: m -> Float
class Matrix m => Orthogonal m o | m -> o, o -> m where
fromOrtho :: o -> m
toOrthoUnsafe :: m -> o
class (Vector v, Orthogonal n o, Diagonal v n) => Projective v n o m p | m -> p, p -> m, p -> o, o -> p, p -> n, n -> p, p -> v, v -> p, n -> o, n -> v, v -> n where
fromProjective :: p -> m
toProjectiveUnsafe :: m -> p
orthogonal :: o -> p
linear :: n -> p
translation :: v -> p
scaling :: v -> p
class (AbelianGroup m, Matrix m) => MatrixNorms m where
frobeniusNorm :: m -> Float
matrixDistance :: m -> m -> Float
operatorNorm :: m -> Float
data Vec2 = Vec2 !!Float !!Float
data Vec3 = Vec3 !!Float !!Float !!Float
data Vec4 = Vec4 !!Float !!Float !!Float !!Float
data Mat2 = Mat2 !Vec2 !Vec2
data Mat3 = Mat3 !Vec3 !Vec3 !Vec3
data Mat4 = Mat4 !Vec4 !Vec4 !Vec4 !Vec4
data Ortho2
data Ortho3
data Ortho4
data Normal2
data Normal3
data Normal4
data Proj3
data Proj4
mkVec2 :: (Float, Float) -> Vec2
mkVec3 :: (Float, Float, Float) -> Vec3
mkVec4 :: (Float, Float, Float, Float) -> Vec4
project :: (Vector v, DotProd v) => v -> v -> v
project' :: (Vector v, UnitVector v u, DotProd v) => v -> u -> v
projectUnsafe :: (Vector v, DotProd v) => v -> v -> v
flipNormal :: UnitVector v n => n -> n
householder :: (Vector v, UnitVector v u, Matrix m, Vector m, Tensor m v) => u -> m
householderOrtho :: (Vector v, UnitVector v u, Matrix m, Vector m, Tensor m v, Orthogonal m o) => u -> o
Documentation
class AbelianGroup g whereSource
Methods
(&+) :: g -> g -> gSource
(&-) :: g -> g -> gSource
neg :: g -> gSource
zero :: gSource
show/hide Instances
vecSum :: AbelianGroup g => [g] -> gSource
class MultSemiGroup r whereSource
Methods
(.*.) :: r -> r -> rSource
one :: rSource
show/hide Instances
class (AbelianGroup r, MultSemiGroup r) => Ring r Source
show/hide Instances
semigroupProduct :: MultSemiGroup r => [r] -> rSource
class LeftModule r m whereSource
Methods
lmul :: r -> m -> mSource
(*.) :: r -> m -> mSource
show/hide Instances
class RightModule m r whereSource
Methods
rmul :: m -> r -> mSource
(.*) :: m -> r -> mSource
show/hide Instances
class AbelianGroup v => Vector v whereSource
Methods
mapVec :: (Float -> Float) -> v -> vSource
scalarMul :: Float -> v -> vSource
(*&) :: Float -> v -> vSource
(&*) :: v -> Float -> vSource
show/hide Instances
class DotProd v whereSource
Methods
(&.) :: v -> v -> FloatSource
norm :: v -> FloatSource
normsqr :: v -> FloatSource
len :: v -> FloatSource
lensqr :: v -> FloatSource
dotprod :: v -> v -> FloatSource
show/hide Instances
class CrossProd v whereSource
Cross product
Methods
crossprod :: v -> v -> vSource
(&^) :: v -> v -> vSource
show/hide Instances
normalize :: (Vector v, DotProd v) => v -> vSource
distance :: (Vector v, DotProd v) => v -> v -> FloatSource
angle :: (Vector v, DotProd v) => v -> v -> FloatSource
the angle between two vectors
angle' :: (Vector v, UnitVector v u, DotProd v) => u -> u -> FloatSource
the angle between two unit vectors
class (Vector v, DotProd v) => UnitVector v u | v -> u, u -> v whereSource
Methods
mkNormalSource
:: v
-> unormalizes the input
toNormalUnsafeSource
:: v
-> udoes not normalize the input!
fromNormal :: u -> vSource
fromNormalRadius :: Float -> u -> vSource
show/hide Instances
class Pointwise v whereSource
Pointwise multiplication
Methods
pointwise :: v -> v -> vSource
(&!) :: v -> v -> vSource
show/hide Instances
class Extend u v whereSource
conversion between vectors (and matrices) of different dimensions
Methods
extendZeroSource
:: u
-> vexample: extendZero (Vec2 5 6) = Vec4 5 6 0 0
extendWithSource
:: Float
-> u
-> vexample: extendWith 1 (Vec2 5 6) = Vec4 5 6 1 1
trimSource
:: v
-> uexample: trim (Vec4 5 6 7 8) = Vec2 5 6
show/hide Instances
class HasCoordinates v x | v -> x whereSource
Methods
_1 :: v -> xSource
_2 :: v -> xSource
_3 :: v -> xSource
_4 :: v -> xSource
show/hide Instances
class Dimension a whereSource
Methods
dim :: a -> IntSource
show/hide Instances
class Matrix m whereSource
Methods
transpose :: m -> mSource
inverse :: m -> mSource
idmtx :: mSource
show/hide Instances
class Tensor t v | t -> v whereSource
Outer product (could be unified with Diagonal?)
Methods
outer :: v -> v -> tSource
show/hide Instances
class Diagonal s t | t -> s whereSource
makes a diagonal matrix from a vector
Methods
diag :: s -> tSource
show/hide Instances
class Determinant m whereSource
Methods
det :: m -> FloatSource
show/hide Instances
class Matrix m => Orthogonal m o | m -> o, o -> m whereSource
Methods
fromOrtho :: o -> mSource
toOrthoUnsafe :: m -> oSource
show/hide Instances
class (Vector v, Orthogonal n o, Diagonal v n) => Projective v n o m p | m -> p, p -> m, p -> o, o -> p, p -> n, n -> p, p -> v, v -> p, n -> o, n -> v, v -> n whereSource
"Projective" matrices have the following form: the top left corner is an any matrix, the bottom right corner is 1, and the top-right column is zero. These describe the affine orthogonal transformation of the space one dimension less.
Methods
fromProjective :: p -> mSource
toProjectiveUnsafe :: m -> pSource
orthogonal :: o -> pSource
linear :: n -> pSource
translation :: v -> pSource
scaling :: v -> pSource
show/hide Instances
class (AbelianGroup m, Matrix m) => MatrixNorms m whereSource
Methods
frobeniusNormSource
:: m
-> Floatthe frobenius norm (= euclidean norm in the space of matrices)
matrixDistanceSource
:: m
-> m
-> Floateuclidean distance in the space of matrices
operatorNormSource
:: m
-> Float(euclidean) operator norm (not implemented yet)
show/hide Instances
data Vec2 Source
Constructors
Vec2 !!Float !!Float
show/hide Instances
data Vec3 Source
Constructors
Vec3 !!Float !!Float !!Float
show/hide Instances
data Vec4 Source
Constructors
Vec4 !!Float !!Float !!Float !!Float
show/hide Instances
data Mat2 Source
The components are row vectors
Constructors
Mat2 !Vec2 !Vec2
show/hide Instances
data Mat3 Source
Constructors
Mat3 !Vec3 !Vec3 !Vec3
show/hide Instances
data Mat4 Source
Constructors
Mat4 !Vec4 !Vec4 !Vec4 !Vec4
show/hide Instances
data Ortho2 Source

Orthogonal matrices.

Note: the Random instances generates orthogonal matrices with determinant 1 (that is, orientation-preserving orthogonal transformations)!

show/hide Instances
data Ortho3 Source
show/hide Instances
data Ortho4 Source
show/hide Instances
data Normal2 Source
The assumption when dealing with these is always that they are of unit length. Also, interpolation works differently.
show/hide Instances
data Normal3 Source
show/hide Instances
data Normal4 Source
show/hide Instances
data Proj3 Source
Projective matrices, encoding affine transformations in dimension one less.
show/hide Instances
data Proj4 Source
show/hide Instances
mkVec2 :: (Float, Float) -> Vec2Source
mkVec3 :: (Float, Float, Float) -> Vec3Source
mkVec4 :: (Float, Float, Float, Float) -> Vec4Source
project :: (Vector v, DotProd v) => v -> v -> vSource
project' :: (Vector v, UnitVector v u, DotProd v) => v -> u -> vSource
Projects the first vector down to the hyperplane orthogonal to the second (unit) vector
projectUnsafe :: (Vector v, DotProd v) => v -> v -> vSource
Direction (second argument) is assumed to be a unit vector!
flipNormal :: UnitVector v n => n -> nSource
Since unit vectors are not a group, we need a separate function.
householder :: (Vector v, UnitVector v u, Matrix m, Vector m, Tensor m v) => u -> mSource
Householder matrix, see http://en.wikipedia.org/wiki/Householder_transformation. In plain words, it is the reflection to the hyperplane orthogonal to the input vector.
householderOrtho :: (Vector v, UnitVector v u, Matrix m, Vector m, Tensor m v, Orthogonal m o) => u -> oSource
Produced by Haddock version 2.4.1