vect-0.4.7: A low-dimensional linear algebra library, tailored to computer graphics.

Data.Vect.Double.Base

Synopsis

# Documentation

class AbelianGroup g whereSource

Methods

(&+) :: g -> g -> gSource

(&-) :: g -> g -> gSource

neg :: g -> gSource

zero :: gSource

vecSum :: AbelianGroup g => [g] -> gSource

class MultSemiGroup r whereSource

Methods

(.*.) :: r -> r -> rSource

one :: rSource

class (AbelianGroup r, MultSemiGroup r) => Ring r Source

Instances

 Ring Mat4 Ring Mat3 Ring Mat2

class LeftModule r m whereSource

Methods

lmul :: r -> m -> mSource

(*.) :: r -> m -> mSource

class RightModule m r whereSource

Methods

rmul :: m -> r -> mSource

(.*) :: m -> r -> mSource

Instances

 RightModule Vec4 Mat4 RightModule Vec3 Mat3 RightModule Vec2 Mat2

class AbelianGroup v => Vector v whereSource

Methods

mapVec :: (Double -> Double) -> v -> vSource

scalarMul :: Double -> v -> vSource

(*&) :: Double -> v -> vSource

(&*) :: v -> Double -> vSource

Instances

 Vector Mat4 Vector Mat3 Vector Mat2 Vector Vec4 Vector Vec3 Vector Vec2 Vector Quaternion

class DotProd v whereSource

Methods

(&.) :: v -> v -> DoubleSource

norm :: v -> DoubleSource

normsqr :: v -> DoubleSource

len :: v -> DoubleSource

lensqr :: v -> DoubleSource

dotprod :: v -> v -> DoubleSource

class CrossProd v whereSource

Cross product

Methods

crossprod :: v -> v -> vSource

(&^) :: v -> v -> vSource

Instances

 CrossProd Normal3 CrossProd Vec3

normalize :: (Vector v, DotProd v) => v -> vSource

distance :: (Vector v, DotProd v) => v -> v -> DoubleSource

angle :: (Vector v, DotProd v) => v -> v -> DoubleSource

the angle between two vectors

angle' :: (Vector v, UnitVector v u, DotProd v) => u -> u -> DoubleSource

the angle between two unit vectors

class (Vector v, DotProd v) => UnitVector v u | v -> u, u -> v whereSource

Methods

Arguments

 :: v -> u normalizes the input

Arguments

 :: v -> u does not normalize the input!

fromNormal :: u -> vSource

fromNormalRadius :: Double -> u -> vSource

class Pointwise v whereSource

Pointwise multiplication

Methods

pointwise :: v -> v -> vSource

(&!) :: v -> v -> vSource

Instances

 Pointwise Mat4 Pointwise Mat3 Pointwise Mat2 Pointwise Vec4 Pointwise Vec3 Pointwise Vec2

class Extend u v whereSource

conversion between vectors (and matrices) of different dimensions

Methods

Arguments

 :: u -> v example: `extendZero (Vec2 5 6) = Vec4 5 6 0 0`

Arguments

 :: Double -> u -> v example: `extendWith 1 (Vec2 5 6) = Vec4 5 6 1 1`

Arguments

 :: v -> u example: `trim (Vec4 5 6 7 8) = Vec2 5 6`

Instances

 Extend Mat3 Mat4 Extend Mat2 Mat4 Extend Mat2 Mat3 Extend Vec3 Vec4 Extend Vec2 Vec4 Extend Vec2 Vec3

class HasCoordinates v x | v -> x whereSource

Methods

_1 :: v -> xSource

_2 :: v -> xSource

_3 :: v -> xSource

_4 :: v -> xSource

class Dimension a whereSource

Methods

dim :: a -> IntSource

class Matrix m whereSource

Methods

transpose :: m -> mSource

inverse :: m -> mSource

idmtx :: mSource

Instances

 Matrix Proj4 Matrix Proj3 Matrix Ortho4 Matrix Ortho3 Matrix Ortho2 Matrix Mat4 Matrix Mat3 Matrix Mat2

class Tensor t v | t -> v whereSource

Outer product (could be unified with Diagonal?)

Methods

outer :: v -> v -> tSource

Instances

 Tensor Mat4 Vec4 Tensor Mat3 Vec3 Tensor Mat2 Vec2

class Diagonal s t | t -> s whereSource

makes a diagonal matrix from a vector

Methods

diag :: s -> tSource

Instances

 Diagonal Vec4 Mat4 Diagonal Vec3 Mat3 Diagonal Vec2 Mat2

class Determinant m whereSource

Methods

det :: m -> DoubleSource

class Matrix m => Orthogonal m o | m -> o, o -> m whereSource

Methods

fromOrtho :: o -> mSource

toOrthoUnsafe :: m -> oSource

Instances

 Orthogonal Mat4 Ortho4 Orthogonal Mat3 Ortho3 Orthogonal Mat2 Ortho2

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.

Instances

 Projective Vec3 Mat3 Ortho3 Mat4 Proj4 Projective Vec2 Mat2 Ortho2 Mat3 Proj3

class (AbelianGroup m, Matrix m) => MatrixNorms m whereSource

Methods

Arguments

 :: m -> Double the frobenius norm (= euclidean norm in the space of matrices)

Arguments

 :: m -> m -> Double euclidean distance in the space of matrices

Arguments

 :: m -> Double (euclidean) operator norm (not implemented yet)

Instances

 MatrixNorms Mat4 MatrixNorms Mat3 MatrixNorms Mat2

data Vec2 Source

Constructors

 Vec2 !Double !Double

data Vec3 Source

Constructors

 Vec3 !Double !Double !Double

data Vec4 Source

Constructors

 Vec4 !Double !Double !Double !Double

data Mat2 Source

The components are row vectors

Constructors

 Mat2 !Vec2 !Vec2

data Mat4 Source

Constructors

 Mat4 !Vec4 !Vec4 !Vec4 !Vec4

data Ortho2 Source

Orthogonal matrices.

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

data Normal2 Source

The assumption when dealing with these is always that they are of unit length. Also, interpolation works differently.

data Proj3 Source

Projective matrices, encoding affine transformations in dimension one less.

Instances

 Read Proj3 Show Proj3 Storable Proj3 Matrix Proj3 MultSemiGroup Proj3 Projective Vec2 Mat2 Ortho2 Mat3 Proj3

data Proj4 Source

Instances

 Read Proj4 Show Proj4 Storable Proj4 Matrix Proj4 MultSemiGroup Proj4 Projective Vec3 Mat3 Ortho3 Mat4 Proj4

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