-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A low-dimensional linear algebra library, tailored to computer graphics. -- -- A low-dimensional (2, 3 and 4) linear algebra library, with lots of -- useful functions. Intended usage is primarily computer graphics (basic -- OpenGL support is included). Projective 4 dimensional operations, as -- used in eg. OpenGL, are also supported. The base field is either Float -- or Double. @package vect @version 0.4.0 module Data.Vect.Double.Base class AbelianGroup g (&+) :: (AbelianGroup g) => g -> g -> g (&-) :: (AbelianGroup g) => g -> g -> g neg :: (AbelianGroup g) => g -> g zero :: (AbelianGroup g) => g vecSum :: (AbelianGroup g) => [g] -> g class (AbelianGroup r) => Ring r (.*.) :: (Ring r) => r -> r -> r one :: (Ring r) => r ringProduct :: (Ring r) => [r] -> r class LeftModule r m lmul :: (LeftModule r m) => r -> m -> m (*.) :: (LeftModule r m) => r -> m -> m class RightModule m r rmul :: (RightModule m r) => m -> r -> m (.*) :: (RightModule m r) => m -> r -> m class (AbelianGroup v) => Vector v mapVec :: (Vector v) => (Double -> Double) -> v -> v scalarMul :: (Vector v) => Double -> v -> v (*&) :: (Vector v) => Double -> v -> v (&*) :: (Vector v) => v -> Double -> v class DotProd v (&.) :: (DotProd v) => v -> v -> Double norm :: (DotProd v) => v -> Double normsqr :: (DotProd v) => v -> Double len :: (DotProd v) => v -> Double lensqr :: (DotProd v) => v -> Double dotprod :: (DotProd v) => v -> v -> Double normalize :: (Vector v, DotProd v) => v -> v distance :: (Vector v, DotProd v) => v -> v -> Double -- | the angle between two vectors angle :: (Vector v, DotProd v) => v -> v -> Double -- | the angle between two unit vectors angle' :: (Vector v, UnitVector v u, DotProd v) => u -> u -> Double class (Vector v, DotProd v) => UnitVector v u | v -> u, u -> v mkNormal :: (UnitVector v u) => v -> u toNormalUnsafe :: (UnitVector v u) => v -> u fromNormal :: (UnitVector v u) => u -> v fromNormalRadius :: (UnitVector v u) => Double -> u -> v -- | projects the first vector onto the direction of the second (unit) -- vector project' :: (Vector v, UnitVector v u, DotProd v) => v -> u -> v -- | direction (second argument) is assumed to be a unit vector! projectUnsafe :: (Vector v, DotProd v) => v -> v -> v project :: (Vector v, DotProd v) => v -> v -> v -- | since unit vectors are not a group, we need a separate function. flipNormal :: (UnitVector v n) => n -> n class CrossProd v crossprod :: (CrossProd v) => v -> v -> v (&^) :: (CrossProd v) => v -> v -> v class Pointwise v pointwise :: (Pointwise v) => v -> v -> v (&!) :: (Pointwise v) => v -> v -> v class HasCoordinates v x | v -> x _1 :: (HasCoordinates v x) => v -> x _2 :: (HasCoordinates v x) => v -> x _3 :: (HasCoordinates v x) => v -> x _4 :: (HasCoordinates v x) => v -> x -- | conversion between vectors (and matrices) of different dimensions class Extend u v extendZero :: (Extend u v) => u -> v extendWith :: (Extend u v) => Double -> u -> v trim :: (Extend u v) => v -> u -- | makes a diagonal matrix from a vector class Diagonal s t | t -> s diag :: (Diagonal s t) => s -> t class Matrix m transpose :: (Matrix m) => m -> m inverse :: (Matrix m) => m -> m idmtx :: (Matrix m) => m -- | Outer product (could be unified with Diagonal?) class Tensor t v | t -> v outer :: (Tensor t v) => v -> v -> t class Determinant m det :: (Determinant m) => m -> Double data Vec2 Vec2 :: !!Double -> !!Double -> Vec2 data Vec3 Vec3 :: !!Double -> !!Double -> !!Double -> Vec3 data Vec4 Vec4 :: !!Double -> !!Double -> !!Double -> !!Double -> Vec4 -- | these are row vectors data Mat2 Mat2 :: !Vec2 -> !Vec2 -> Mat2 data Mat3 Mat3 :: !Vec3 -> !Vec3 -> !Vec3 -> Mat3 data Mat4 Mat4 :: !Vec4 -> !Vec4 -> !Vec4 -> !Vec4 -> Mat4 -- | The assumption when dealing with these is always that they are of unit -- length. Also, interpolation works differently. newtype Normal2 Normal2 :: Vec2 -> Normal2 newtype Normal3 Normal3 :: Vec3 -> Normal3 newtype Normal4 Normal4 :: Vec4 -> Normal4 mkVec2 :: (Double, Double) -> Vec2 mkVec3 :: (Double, Double, Double) -> Vec3 mkVec4 :: (Double, Double, Double, Double) -> Vec4 rndUnit :: (RandomGen g, Random v, Vector v, DotProd v) => g -> (v, g) instance Read Normal4 instance Show Normal4 instance DotProd Normal4 instance Storable Normal4 instance Read Normal3 instance Show Normal3 instance DotProd Normal3 instance Storable Normal3 instance CrossProd Normal3 instance Read Normal2 instance Show Normal2 instance DotProd Normal2 instance Storable Normal2 instance Read Mat4 instance Show Mat4 instance Read Mat3 instance Show Mat3 instance Read Mat2 instance Show Mat2 instance Read Vec4 instance Show Vec4 instance Read Vec3 instance Show Vec3 instance Read Vec2 instance Show Vec2 instance Extend Mat3 Mat4 instance Extend Mat2 Mat4 instance Extend Mat2 Mat3 instance Extend Vec3 Vec4 instance Extend Vec2 Vec4 instance Extend Vec2 Vec3 instance Storable Mat4 instance Tensor Mat4 Vec4 instance Diagonal Vec4 Mat4 instance RightModule Vec4 Mat4 instance LeftModule Mat4 Vec4 instance Ring Mat4 instance Vector Mat4 instance AbelianGroup Mat4 instance Matrix Mat4 instance HasCoordinates Mat4 Vec4 instance Storable Vec4 instance Random Vec4 instance Pointwise Vec4 instance DotProd Vec4 instance Vector Vec4 instance AbelianGroup Vec4 instance HasCoordinates Vec4 Double instance Storable Mat3 instance Determinant Mat3 instance Tensor Mat3 Vec3 instance Diagonal Vec3 Mat3 instance RightModule Vec3 Mat3 instance LeftModule Mat3 Vec3 instance Ring Mat3 instance Vector Mat3 instance AbelianGroup Mat3 instance Matrix Mat3 instance HasCoordinates Mat3 Vec3 instance Storable Vec3 instance Determinant (Vec3, Vec3, Vec3) instance CrossProd Vec3 instance Random Vec3 instance Pointwise Vec3 instance DotProd Vec3 instance Vector Vec3 instance AbelianGroup Vec3 instance HasCoordinates Vec3 Double instance Storable Mat2 instance Determinant Mat2 instance Tensor Mat2 Vec2 instance Diagonal Vec2 Mat2 instance RightModule Vec2 Mat2 instance LeftModule Mat2 Vec2 instance Ring Mat2 instance Vector Mat2 instance AbelianGroup Mat2 instance Matrix Mat2 instance HasCoordinates Mat2 Vec2 instance Storable Vec2 instance Random Vec2 instance Determinant (Vec2, Vec2) instance Pointwise Vec2 instance DotProd Vec2 instance Vector Vec2 instance AbelianGroup Vec2 instance HasCoordinates Vec2 Double instance Random Normal4 instance Random Normal3 instance Random Normal2 instance UnitVector Vec4 Normal4 instance UnitVector Vec3 Normal3 instance UnitVector Vec2 Normal2 -- | Gram-Schmidt orthogonalization. This module is not re-exported by -- Data.Vect. module Data.Vect.Double.GramSchmidt -- | produces orthogonal/orthonormal vectors from a set of vectors class GramSchmidt a gramSchmidt :: (GramSchmidt a) => a -> a gramSchmidtNormalize :: (GramSchmidt a) => a -> a instance GramSchmidt (Normal4, Normal4, Normal4, Normal4) instance GramSchmidt (Vec4, Vec4, Vec4, Vec4) instance GramSchmidt (Normal4, Normal4, Normal4) instance GramSchmidt (Normal3, Normal3, Normal3) instance GramSchmidt (Vec4, Vec4, Vec4) instance GramSchmidt (Vec3, Vec3, Vec3) instance GramSchmidt (Normal4, Normal4) instance GramSchmidt (Normal3, Normal3) instance GramSchmidt (Normal2, Normal2) instance GramSchmidt (Vec4, Vec4) instance GramSchmidt (Vec3, Vec3) instance GramSchmidt (Vec2, Vec2) module Data.Vect.Double.Util.Dim2 -- | example: structVec2 [1,2,3,4] = [ Vec2 1 2 , Vec2 3 4 ]. structVec2 :: [Double] -> [Vec2] destructVec2 :: [Vec2] -> [Double] det2 :: Vec2 -> Vec2 -> Double vec2X :: Vec2 vec2Y :: Vec2 translate2X :: Double -> Vec2 -> Vec2 translate2Y :: Double -> Vec2 -> Vec2 -- | unit vector with given angle relative to the positive X axis (in the -- positive direction, that is, CCW). A more precise name would be -- cosSin, but that sounds bad :) sinCos :: Double -> Vec2 sinCos' :: Double -> Normal2 sinCosRadius :: Double -> Double -> Vec2 -- | The angle relative to the positive X axis angle2 :: Vec2 -> Double angle2' :: Normal2 -> Double -- | Rotation matrix by a given angle (in radians), counterclockwise. rotMatrix2 :: Double -> Mat2 rotate2 :: Double -> Vec2 -> Vec2 -- | Rotates counterclockwise by 90 degrees. rotateCCW :: Vec2 -> Vec2 -- | Rotates clockwise by 90 degrees. rotateCW :: Vec2 -> Vec2 module Data.Vect.Double.Util.Dim3 structVec3 :: [Double] -> [Vec3] destructVec3 :: [Vec3] -> [Double] det3 :: Vec3 -> Vec3 -> Vec3 -> Double translate3X :: Double -> Vec3 -> Vec3 translate3Y :: Double -> Vec3 -> Vec3 translate3Z :: Double -> Vec3 -> Vec3 vec3X :: Vec3 vec3Y :: Vec3 vec3Z :: Vec3 rotMatrixZ :: Double -> Mat3 rotMatrixY :: Double -> Mat3 rotMatrixX :: Double -> Mat3 rotate3' :: Double -> Normal3 -> Vec3 -> Vec3 rotate3 :: Double -> Vec3 -> Vec3 -> Vec3 -- | Rotation around an arbitrary 3D vector. The resulting 3x3 matrix is -- intended for multiplication on the right. rotMatrix3 :: Vec3 -> Double -> Mat3 -- | Rotation around an arbitrary 3D unit vector. The resulting 3x3 -- matrix is intended for multiplication on the right. rotMatrix3' :: Normal3 -> Double -> Mat3 -- | Interpolation of vectors. Note: we interpolate unit vectors -- differently from ordinary vectors. module Data.Vect.Double.Interpolate class Interpolate v interpolate :: (Interpolate v) => Double -> v -> v -> v instance Interpolate Normal3 instance Interpolate Normal2 instance Interpolate Vec4 instance Interpolate Vec3 instance Interpolate Vec2 instance Interpolate Double -- | Rotation around an arbitrary plane in four dimensions, and other -- miscellanea. Not very useful for most people, and not re-exported by -- Data.Vect. module Data.Vect.Double.Util.Dim4 structVec4 :: [Double] -> [Vec4] destructVec4 :: [Vec4] -> [Double] translate4X :: Double -> Vec4 -> Vec4 translate4Y :: Double -> Vec4 -> Vec4 translate4Z :: Double -> Vec4 -> Vec4 translate4W :: Double -> Vec4 -> Vec4 vec4X :: Vec4 vec4Y :: Vec4 vec4Z :: Vec4 vec4W :: Vec4 -- | If (x,y,u,v) is an orthonormal system, then (written in -- pseudo-code) biVector4 (x,y) = plusMinus (reverse $ biVector4 -- (u,v)). This is a helper function for the 4 dimensional rotation -- code. If (x,y,z,p,q,r) = biVector4 a b, then the -- corresponding antisymmetric tensor is -- --
--   [  0  r  q  p ]
--   [ -r  0  z -y ]
--   [ -q -z  0  x ]
--   [ -p  y -x  0 ]
--   
biVector4 :: Vec4 -> Vec4 -> (Double, Double, Double, Double, Double, Double) -- | the corresponding antisymmetric tensor biVector4AsTensor :: Vec4 -> Vec4 -> Mat4 -- | We assume that the axes are normalized and orthogonal to each -- other! rotate4' :: Double -> (Normal4, Normal4) -> Vec4 -> Vec4 -- | We assume only that the axes are independent vectors. rotate4 :: Double -> (Vec4, Vec4) -> Vec4 -> Vec4 -- | Rotation matrix around a plane specified by two normalized and -- orthogonal vectors. Intended for multiplication on the -- right! rotMatrix4' :: Double -> (Normal4, Normal4) -> Mat4 -- | We assume only that the axes are independent vectors. rotMatrix4 :: Double -> (Vec4, Vec4) -> Mat4 -- | Classic 4x4 projective matrices. Our convention is that they are -- intended for multiplication on the right, that is, they are of -- the form -- --
--       _____
--   [  |     |  0  ]
--   [  | 3x3 |  0  ]
--   [  |_____|  0  ]
--   [  p  q  r  1  ]
--   
-- -- Please note that by default, OpenGL stores the matrices (in memory) by -- columns, while we store them by rows; but OpenGL also use the opposite -- convention (so the OpenGL projective matrices are intended for -- multiplication on the left). So in effect, they are the same -- when stored in the memory, say with poke :: Ptr Mat4 -> Mat4 -- -> IO (). module Data.Vect.Double.Util.Projective class ExtendProjective v e | v -> e extendProj :: (ExtendProjective v e) => v -> e extendProjWith :: (ExtendProjective v e) => Double -> v -> e rotMatrixProj :: Double -> Normal3 -> Mat4 rotMatrixProj' :: Double -> Vec3 -> Mat4 translMatrixProj :: Vec3 -> Mat4 -- | we assume that the bottom-right corner is 1. translWithProj :: Vec3 -> Mat4 -> Mat4 scaleMatrixProj :: Vec3 -> Mat4 scaleMatrixUniformProj :: Double -> Mat4 class ProjectiveAction v actProj :: (ProjectiveAction v) => v -> Mat4 -> v -- | Inverts a projective 4x4 matrix, assuming that the top-left 3x3 part -- is orthogonal, and the bottom-right corner is 1. invertProj :: Mat4 -> Mat4 instance ProjectiveAction Normal3 instance ProjectiveAction Vec4 instance ProjectiveAction Vec3 instance ExtendProjective Mat3 Mat4 instance ExtendProjective Mat2 Mat4 instance ExtendProjective Vec4 Vec4 instance ExtendProjective Vec3 Vec4 instance ExtendProjective Vec2 Vec4 module Data.Vect.Float.Base class AbelianGroup g (&+) :: (AbelianGroup g) => g -> g -> g (&-) :: (AbelianGroup g) => g -> g -> g neg :: (AbelianGroup g) => g -> g zero :: (AbelianGroup g) => g vecSum :: (AbelianGroup g) => [g] -> g class (AbelianGroup r) => Ring r (.*.) :: (Ring r) => r -> r -> r one :: (Ring r) => r ringProduct :: (Ring r) => [r] -> r class LeftModule r m lmul :: (LeftModule r m) => r -> m -> m (*.) :: (LeftModule r m) => r -> m -> m class RightModule m r rmul :: (RightModule m r) => m -> r -> m (.*) :: (RightModule m r) => m -> r -> m class (AbelianGroup v) => Vector v mapVec :: (Vector v) => (Float -> Float) -> v -> v scalarMul :: (Vector v) => Float -> v -> v (*&) :: (Vector v) => Float -> v -> v (&*) :: (Vector v) => v -> Float -> v class DotProd v (&.) :: (DotProd v) => v -> v -> Float norm :: (DotProd v) => v -> Float normsqr :: (DotProd v) => v -> Float len :: (DotProd v) => v -> Float lensqr :: (DotProd v) => v -> Float dotprod :: (DotProd v) => v -> v -> Float normalize :: (Vector v, DotProd v) => v -> v distance :: (Vector v, DotProd v) => v -> v -> Float -- | the angle between two vectors angle :: (Vector v, DotProd v) => v -> v -> Float -- | the angle between two unit vectors angle' :: (Vector v, UnitVector v u, DotProd v) => u -> u -> Float class (Vector v, DotProd v) => UnitVector v u | v -> u, u -> v mkNormal :: (UnitVector v u) => v -> u toNormalUnsafe :: (UnitVector v u) => v -> u fromNormal :: (UnitVector v u) => u -> v fromNormalRadius :: (UnitVector v u) => Float -> u -> v -- | projects the first vector onto the direction of the second (unit) -- vector project' :: (Vector v, UnitVector v u, DotProd v) => v -> u -> v -- | direction (second argument) is assumed to be a unit vector! projectUnsafe :: (Vector v, DotProd v) => v -> v -> v project :: (Vector v, DotProd v) => v -> v -> v -- | since unit vectors are not a group, we need a separate function. flipNormal :: (UnitVector v n) => n -> n class CrossProd v crossprod :: (CrossProd v) => v -> v -> v (&^) :: (CrossProd v) => v -> v -> v class Pointwise v pointwise :: (Pointwise v) => v -> v -> v (&!) :: (Pointwise v) => v -> v -> v class HasCoordinates v x | v -> x _1 :: (HasCoordinates v x) => v -> x _2 :: (HasCoordinates v x) => v -> x _3 :: (HasCoordinates v x) => v -> x _4 :: (HasCoordinates v x) => v -> x -- | conversion between vectors (and matrices) of different dimensions class Extend u v extendZero :: (Extend u v) => u -> v extendWith :: (Extend u v) => Float -> u -> v trim :: (Extend u v) => v -> u -- | makes a diagonal matrix from a vector class Diagonal s t | t -> s diag :: (Diagonal s t) => s -> t class Matrix m transpose :: (Matrix m) => m -> m inverse :: (Matrix m) => m -> m idmtx :: (Matrix m) => m -- | Outer product (could be unified with Diagonal?) class Tensor t v | t -> v outer :: (Tensor t v) => v -> v -> t class Determinant m det :: (Determinant m) => m -> Float data Vec2 Vec2 :: !!Float -> !!Float -> Vec2 data Vec3 Vec3 :: !!Float -> !!Float -> !!Float -> Vec3 data Vec4 Vec4 :: !!Float -> !!Float -> !!Float -> !!Float -> Vec4 -- | these are row vectors data Mat2 Mat2 :: !Vec2 -> !Vec2 -> Mat2 data Mat3 Mat3 :: !Vec3 -> !Vec3 -> !Vec3 -> Mat3 data Mat4 Mat4 :: !Vec4 -> !Vec4 -> !Vec4 -> !Vec4 -> Mat4 -- | The assumption when dealing with these is always that they are of unit -- length. Also, interpolation works differently. newtype Normal2 Normal2 :: Vec2 -> Normal2 newtype Normal3 Normal3 :: Vec3 -> Normal3 newtype Normal4 Normal4 :: Vec4 -> Normal4 mkVec2 :: (Float, Float) -> Vec2 mkVec3 :: (Float, Float, Float) -> Vec3 mkVec4 :: (Float, Float, Float, Float) -> Vec4 rndUnit :: (RandomGen g, Random v, Vector v, DotProd v) => g -> (v, g) instance Read Normal4 instance Show Normal4 instance DotProd Normal4 instance Storable Normal4 instance Read Normal3 instance Show Normal3 instance DotProd Normal3 instance Storable Normal3 instance CrossProd Normal3 instance Read Normal2 instance Show Normal2 instance DotProd Normal2 instance Storable Normal2 instance Read Mat4 instance Show Mat4 instance Read Mat3 instance Show Mat3 instance Read Mat2 instance Show Mat2 instance Read Vec4 instance Show Vec4 instance Read Vec3 instance Show Vec3 instance Read Vec2 instance Show Vec2 instance Extend Mat3 Mat4 instance Extend Mat2 Mat4 instance Extend Mat2 Mat3 instance Extend Vec3 Vec4 instance Extend Vec2 Vec4 instance Extend Vec2 Vec3 instance Storable Mat4 instance Tensor Mat4 Vec4 instance Diagonal Vec4 Mat4 instance RightModule Vec4 Mat4 instance LeftModule Mat4 Vec4 instance Ring Mat4 instance Vector Mat4 instance AbelianGroup Mat4 instance Matrix Mat4 instance HasCoordinates Mat4 Vec4 instance Storable Vec4 instance Random Vec4 instance Pointwise Vec4 instance DotProd Vec4 instance Vector Vec4 instance AbelianGroup Vec4 instance HasCoordinates Vec4 Float instance Storable Mat3 instance Determinant Mat3 instance Tensor Mat3 Vec3 instance Diagonal Vec3 Mat3 instance RightModule Vec3 Mat3 instance LeftModule Mat3 Vec3 instance Ring Mat3 instance Vector Mat3 instance AbelianGroup Mat3 instance Matrix Mat3 instance HasCoordinates Mat3 Vec3 instance Storable Vec3 instance Determinant (Vec3, Vec3, Vec3) instance CrossProd Vec3 instance Random Vec3 instance Pointwise Vec3 instance DotProd Vec3 instance Vector Vec3 instance AbelianGroup Vec3 instance HasCoordinates Vec3 Float instance Storable Mat2 instance Determinant Mat2 instance Tensor Mat2 Vec2 instance Diagonal Vec2 Mat2 instance RightModule Vec2 Mat2 instance LeftModule Mat2 Vec2 instance Ring Mat2 instance Vector Mat2 instance AbelianGroup Mat2 instance Matrix Mat2 instance HasCoordinates Mat2 Vec2 instance Storable Vec2 instance Random Vec2 instance Determinant (Vec2, Vec2) instance Pointwise Vec2 instance DotProd Vec2 instance Vector Vec2 instance AbelianGroup Vec2 instance HasCoordinates Vec2 Float instance Random Normal4 instance Random Normal3 instance Random Normal2 instance UnitVector Vec4 Normal4 instance UnitVector Vec3 Normal3 instance UnitVector Vec2 Normal2 -- | Gram-Schmidt orthogonalization. This module is not re-exported by -- Data.Vect. module Data.Vect.Float.GramSchmidt -- | produces orthogonal/orthonormal vectors from a set of vectors class GramSchmidt a gramSchmidt :: (GramSchmidt a) => a -> a gramSchmidtNormalize :: (GramSchmidt a) => a -> a instance GramSchmidt (Normal4, Normal4, Normal4, Normal4) instance GramSchmidt (Vec4, Vec4, Vec4, Vec4) instance GramSchmidt (Normal4, Normal4, Normal4) instance GramSchmidt (Normal3, Normal3, Normal3) instance GramSchmidt (Vec4, Vec4, Vec4) instance GramSchmidt (Vec3, Vec3, Vec3) instance GramSchmidt (Normal4, Normal4) instance GramSchmidt (Normal3, Normal3) instance GramSchmidt (Normal2, Normal2) instance GramSchmidt (Vec4, Vec4) instance GramSchmidt (Vec3, Vec3) instance GramSchmidt (Vec2, Vec2) module Data.Vect.Float.Util.Dim2 -- | example: structVec2 [1,2,3,4] = [ Vec2 1 2 , Vec2 3 4 ]. structVec2 :: [Float] -> [Vec2] destructVec2 :: [Vec2] -> [Float] det2 :: Vec2 -> Vec2 -> Float vec2X :: Vec2 vec2Y :: Vec2 translate2X :: Float -> Vec2 -> Vec2 translate2Y :: Float -> Vec2 -> Vec2 -- | unit vector with given angle relative to the positive X axis (in the -- positive direction, that is, CCW). A more precise name would be -- cosSin, but that sounds bad :) sinCos :: Float -> Vec2 sinCos' :: Float -> Normal2 sinCosRadius :: Float -> Float -> Vec2 -- | The angle relative to the positive X axis angle2 :: Vec2 -> Float angle2' :: Normal2 -> Float -- | Rotation matrix by a given angle (in radians), counterclockwise. rotMatrix2 :: Float -> Mat2 rotate2 :: Float -> Vec2 -> Vec2 -- | Rotates counterclockwise by 90 degrees. rotateCCW :: Vec2 -> Vec2 -- | Rotates clockwise by 90 degrees. rotateCW :: Vec2 -> Vec2 module Data.Vect.Float.Util.Dim3 structVec3 :: [Float] -> [Vec3] destructVec3 :: [Vec3] -> [Float] det3 :: Vec3 -> Vec3 -> Vec3 -> Float translate3X :: Float -> Vec3 -> Vec3 translate3Y :: Float -> Vec3 -> Vec3 translate3Z :: Float -> Vec3 -> Vec3 vec3X :: Vec3 vec3Y :: Vec3 vec3Z :: Vec3 rotMatrixZ :: Float -> Mat3 rotMatrixY :: Float -> Mat3 rotMatrixX :: Float -> Mat3 rotate3' :: Float -> Normal3 -> Vec3 -> Vec3 rotate3 :: Float -> Vec3 -> Vec3 -> Vec3 -- | Rotation around an arbitrary 3D vector. The resulting 3x3 matrix is -- intended for multiplication on the right. rotMatrix3 :: Vec3 -> Float -> Mat3 -- | Rotation around an arbitrary 3D unit vector. The resulting 3x3 -- matrix is intended for multiplication on the right. rotMatrix3' :: Normal3 -> Float -> Mat3 -- | Interpolation of vectors. Note: we interpolate unit vectors -- differently from ordinary vectors. module Data.Vect.Float.Interpolate class Interpolate v interpolate :: (Interpolate v) => Float -> v -> v -> v instance Interpolate Normal3 instance Interpolate Normal2 instance Interpolate Vec4 instance Interpolate Vec3 instance Interpolate Vec2 instance Interpolate Float -- | Rotation around an arbitrary plane in four dimensions, and other -- miscellanea. Not very useful for most people, and not re-exported by -- Data.Vect. module Data.Vect.Float.Util.Dim4 structVec4 :: [Float] -> [Vec4] destructVec4 :: [Vec4] -> [Float] translate4X :: Float -> Vec4 -> Vec4 translate4Y :: Float -> Vec4 -> Vec4 translate4Z :: Float -> Vec4 -> Vec4 translate4W :: Float -> Vec4 -> Vec4 vec4X :: Vec4 vec4Y :: Vec4 vec4Z :: Vec4 vec4W :: Vec4 -- | If (x,y,u,v) is an orthonormal system, then (written in -- pseudo-code) biVector4 (x,y) = plusMinus (reverse $ biVector4 -- (u,v)). This is a helper function for the 4 dimensional rotation -- code. If (x,y,z,p,q,r) = biVector4 a b, then the -- corresponding antisymmetric tensor is -- --
--   [  0  r  q  p ]
--   [ -r  0  z -y ]
--   [ -q -z  0  x ]
--   [ -p  y -x  0 ]
--   
biVector4 :: Vec4 -> Vec4 -> (Float, Float, Float, Float, Float, Float) -- | the corresponding antisymmetric tensor biVector4AsTensor :: Vec4 -> Vec4 -> Mat4 -- | We assume that the axes are normalized and orthogonal to each -- other! rotate4' :: Float -> (Normal4, Normal4) -> Vec4 -> Vec4 -- | We assume only that the axes are independent vectors. rotate4 :: Float -> (Vec4, Vec4) -> Vec4 -> Vec4 -- | Rotation matrix around a plane specified by two normalized and -- orthogonal vectors. Intended for multiplication on the -- right! rotMatrix4' :: Float -> (Normal4, Normal4) -> Mat4 -- | We assume only that the axes are independent vectors. rotMatrix4 :: Float -> (Vec4, Vec4) -> Mat4 -- | Classic 4x4 projective matrices. Our convention is that they are -- intended for multiplication on the right, that is, they are of -- the form -- --
--       _____
--   [  |     |  0  ]
--   [  | 3x3 |  0  ]
--   [  |_____|  0  ]
--   [  p  q  r  1  ]
--   
-- -- Please note that by default, OpenGL stores the matrices (in memory) by -- columns, while we store them by rows; but OpenGL also use the opposite -- convention (so the OpenGL projective matrices are intended for -- multiplication on the left). So in effect, they are the same -- when stored in the memory, say with poke :: Ptr Mat4 -> Mat4 -- -> IO (). module Data.Vect.Float.Util.Projective class ExtendProjective v e | v -> e extendProj :: (ExtendProjective v e) => v -> e extendProjWith :: (ExtendProjective v e) => Float -> v -> e rotMatrixProj :: Float -> Normal3 -> Mat4 rotMatrixProj' :: Float -> Vec3 -> Mat4 translMatrixProj :: Vec3 -> Mat4 -- | we assume that the bottom-right corner is 1. translWithProj :: Vec3 -> Mat4 -> Mat4 scaleMatrixProj :: Vec3 -> Mat4 scaleMatrixUniformProj :: Float -> Mat4 class ProjectiveAction v actProj :: (ProjectiveAction v) => v -> Mat4 -> v -- | Inverts a projective 4x4 matrix, assuming that the top-left 3x3 part -- is orthogonal, and the bottom-right corner is 1. invertProj :: Mat4 -> Mat4 instance ProjectiveAction Normal3 instance ProjectiveAction Vec4 instance ProjectiveAction Vec3 instance ExtendProjective Mat3 Mat4 instance ExtendProjective Mat2 Mat4 instance ExtendProjective Vec4 Vec4 instance ExtendProjective Vec3 Vec4 instance ExtendProjective Vec2 Vec4 -- | OpenGL support, inclduing vertex, texCoord, etc -- instances for Vec2, Vec3 and Vec4. module Data.Vect.Double.OpenGL radianToDegrees :: (RealFrac a) => a -> a degreesToRadian :: (Floating a) => a -> a -- | The angle is in radians. (WARNING: OpenGL uses degrees!) rotate :: Double -> Vec3 -> IO () translate :: Vec3 -> IO () scale3 :: Vec3 -> IO () scale :: Double -> IO () class VertexAttrib' a vertexAttrib :: (VertexAttrib' a) => AttribLocation -> a -> IO () instance VertexAttrib' Normal4 instance VertexAttrib' Normal3 instance VertexAttrib' Normal2 instance VertexAttrib' Vec4 instance VertexAttrib' Vec3 instance VertexAttrib' Vec2 instance VertexAttrib' Double instance TexCoord Vec4 instance TexCoord Vec3 instance TexCoord Vec2 instance SecondaryColor Vec3 instance Color Vec4 instance Color Vec3 instance Normal Normal3 instance Vertex Vec4 instance Vertex Vec3 instance Vertex Vec2 module Data.Vect.Double -- | OpenGL support, inclduing vertex, texCoord, etc -- instances for Vec2, Vec3 and Vec4. module Data.Vect.Float.OpenGL radianToDegrees :: (RealFrac a) => a -> a degreesToRadian :: (Floating a) => a -> a -- | The angle is in radians. (WARNING: OpenGL uses degrees!) rotate :: Float -> Vec3 -> IO () translate :: Vec3 -> IO () scale3 :: Vec3 -> IO () scale :: Float -> IO () class VertexAttrib' a vertexAttrib :: (VertexAttrib' a) => AttribLocation -> a -> IO () instance Uniform Vec4 instance Uniform Vec3 instance Uniform Vec2 instance Uniform Float instance VertexAttrib' Normal4 instance VertexAttrib' Normal3 instance VertexAttrib' Normal2 instance VertexAttrib' Vec4 instance VertexAttrib' Vec3 instance VertexAttrib' Vec2 instance VertexAttrib' Float instance TexCoord Vec4 instance TexCoord Vec3 instance TexCoord Vec2 instance SecondaryColor Vec3 instance Color Vec4 instance Color Vec3 instance Normal Normal3 instance Vertex Vec4 instance Vertex Vec3 instance Vertex Vec2 module Data.Vect.Float -- | Importing this module is equivalent to importing -- Data.Vect.Float. module Data.Vect