Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CGLA Namespace Reference

Computer Graphics Linear Algebra. More...


Classes

class  ArithMatFloat
 Basic class template for matrices. More...
class  ArithQuat
 A T based Quaterinion class. More...
class  ArithSqMat2x2Float
 Two by two float matrix template. More...
class  ArithSqMat3x3Float
 3 by 3 float matrix template. More...
class  ArithSqMat4x4Float
 4 by 4 float matrix template. More...
class  ArithSqMatFloat
 Template for square matrices. More...
class  ArithVec
 Template representing generic arithmetic vectors. More...
class  ArithVec2Float
class  ArithVec3Float
class  ArithVec3Int
class  ArithVec4Float
 A four dimensional floating point vector template. More...
class  ArithVecFloat
class  ArithVecInt
class  BitMask
 The BitMask class is mostly a utility class. More...
class  CGLAMotherException
class  Mat2x2d
 Two by two double matrix. More...
class  Mat2x2f
 Two by two float matrix. More...
class  Mat2x3d
 2x3 double matrix class. More...
class  Mat3x2d
 3x2 double matrix class. More...
class  Mat2x3f
 2x3 float matrix class. More...
class  Mat3x2f
 3x2 float matrix class. More...
class  Mat3x3d
 3 by 3 double matrix. More...
class  Mat3x3f
 3 by 3 float matrix. More...
class  Mat4x4d
 4x4 double matrix. More...
class  Mat4x4f
 4x4 float matrix. This class is useful for transformations such as perspective projections or translation where 3x3 matrices do not suffice. More...
class  Quatd
 A float based Quaterinion class. More...
class  Quatf
 A float based Quaterinion class. More...
class  UnitVector
 The UnitVector stores a unit length vector as two angles. More...
class  Vec2d
 2D double floating point vector More...
class  Vec2f
 2D floating point vector More...
class  Vec2i
 2D Integer vector. More...
class  Vec2ui
 2D Integer vector. More...
class  Vec3d
 A 3D double vector. More...
class  Vec3f
 3D float vector. More...
class  Vec3i
 3D integer vector. More...
class  Vec3uc
 3D unsigned char vector. More...
class  Vec3usi
 Unsigned short int 3D vector class. More...
class  Vec4d
 A four dimensional floating point vector. More...
class  Vec4f
 A four dimensional floating point vector. More...
class  Vec4uc
 4D unsigned char vector. More...

Namespaces

namespace  TableTrigonometry

Typedefs

typedef Quatf Quaternion
typedef Vec4f Vec3Hf
 A 3D homogeneous vector is simply a four D vector.
typedef unsigned char UChar
typedef unsigned short int USInt

Enumerations

enum  Axis { XAXIS = 0, YAXIS = 1, ZAXIS = 2 }
 Useful enum that represents coordiante axes. More...

Functions

template<class VVT, class HVT, class MT, unsigned int ROWS>
const MT operator * (double k, const ArithMatFloat< VVT, HVT, MT, ROWS > &v)
 Multiply scalar onto matrix.
template<class VVT, class HVT, class MT, unsigned int ROWS>
const MT operator * (float k, const ArithMatFloat< VVT, HVT, MT, ROWS > &v)
 Multiply scalar onto matrix.
template<class VVT, class HVT, class MT, unsigned int ROWS>
const MT operator * (int k, const ArithMatFloat< VVT, HVT, MT, ROWS > &v)
 Multiply scalar onto matrix.
template<class VVT, class HVT, class MT, unsigned int ROWS>
VVT operator * (const ArithMatFloat< VVT, HVT, MT, ROWS > &m, const HVT &v)
 Multiply vector onto matrix.
template<class VVT, class HVT, class HV1T, class VV2T, class MT1, class MT2, class MT, unsigned int ROWS1, unsigned int ROWS2>
void mul (const ArithMatFloat< VVT, HV1T, MT1, ROWS1 > &m1, const ArithMatFloat< VV2T, HVT, MT2, ROWS2 > &m2, ArithMatFloat< VVT, HVT, MT, ROWS1 > &m)
 Multiply two arbitrary matrices.
template<class VVT, class HVT, class M1T, class M2T, unsigned int ROWS, unsigned int COLS>
void transpose (const ArithMatFloat< VVT, HVT, M1T, ROWS > &m, ArithMatFloat< HVT, VVT, M2T, COLS > &m_new)
 Transpose.
template<class VVT, class HVT, class MT, unsigned int ROWS>
void outer_product (const VVT &a, const HVT &b, ArithMatFloat< VVT, HVT, MT, ROWS > &m)
 Compute the outer product of a and b: a * transpose(b).
template<class VVT, class HVT, class MT, int ROWS, class BinOp>
void outer_product (const VVT &a, const HVT &b, ArithMatFloat< VVT, HVT, MT, ROWS > &m, BinOp op)
 Compute the outer product of a and b using an arbitrary binary operation: op(a, transpose(b)).
template<class M1, class M2>
void copy_matrix (const M1 &inmat, M2 &outmat)
 Copy a matrix to another matrix, cell by cell.
template<class VVT, class HVT, class MT, unsigned int ROWS>
std::ostream & operator<< (std::ostream &os, const ArithMatFloat< VVT, HVT, MT, ROWS > &m)
 Put to operator.
template<class VVT, class HVT, class MT, unsigned int ROWS>
std::istream & operator>> (std::istream &is, const ArithMatFloat< VVT, HVT, MT, ROWS > &m)
 Get from operator.
template<class T, class V, class Q>
operator * (T scalar, const ArithQuat< T, V, Q > &q)
template<class T, class V, class Q>
slerp (const ArithQuat< T, V, Q > &q0, const ArithQuat< T, V, Q > &q1, T t)
 Perform linear interpolation of two quaternions.
template<class T, class V, class Q>
std::ostream & operator<< (std::ostream &os, const ArithQuat< T, V, Q > &v)
 Print quaternion to stream.
 CGLA_DERIVEEXCEPTION (Mat2x2fException)
template<class V, class M>
ArithSqMat2x2Float< V, M
>::ScalarType 
determinant (const ArithSqMat2x2Float< V, M > &m)
 Compute the determinant of a Mat2x2f.
template<class V, class M>
const M invert (const ArithSqMat2x2Float< V, M > &m)
template<class V, class M>
invert (const ArithSqMat3x3Float< V, M > &)
 Invert 3x3 matrix.
template<class V, class M>
ArithSqMat3x3Float< V, M
>::ScalarType 
determinant (const ArithSqMat3x3Float< V, M > &m)
 Compute determinant.
template<class VT, class M>
adjoint (const ArithSqMat4x4Float< VT, M > &)
 Compute the adjoint of a matrix.
template<class V, class M>
double determinant (const ArithSqMat4x4Float< V, M > &m)
 Compute the determinant of a 4x4 matrix.
template<class VT, class M>
invert (const ArithSqMat4x4Float< VT, M > &)
 Compute the inverse matrix of a Mat4x4f.
template<class VT, class M>
invert_affine (const ArithSqMat4x4Float< VT, M > &)
 Compute the inverse matrix of a Mat4x4f that is affine.
template<class VT, class MT, unsigned int ROWS>
MT operator * (const ArithSqMatFloat< VT, MT, ROWS > &m1, const ArithSqMatFloat< VT, MT, ROWS > &m2)
 Multiply two matrices derived from same type, producing a new of same type.
template<class VT, class MT, unsigned int ROWS>
MT transpose (const ArithSqMatFloat< VT, MT, ROWS > &m)
 Compute the transpose of a square matrix.
template<class VT, class MT, unsigned int ROWS>
MT::ScalarType trace (const ArithSqMatFloat< VT, MT, ROWS > &M)
 Compute trace. Works only for sq. matrices.
template<class T, class V, unsigned int N>
std::ostream & operator<< (std::ostream &os, const ArithVec< T, V, N > &v)
template<class T, class V, unsigned int N>
std::istream & operator>> (std::istream &is, ArithVec< T, V, N > &v)
 Get from operator for ArithVec descendants.
template<class T, class V, unsigned int N>
dot (const ArithVec< T, V, N > &v0, const ArithVec< T, V, N > &v1)
 Dot product for two vectors.
template<class T, class V, unsigned int N>
sqr_length (const ArithVec< T, V, N > &v)
 Compute the sqr length by taking dot product of vector with itself.
template<class T, class V, unsigned int N>
const V operator * (double k, const ArithVec< T, V, N > &v)
 Multiply double onto vector.
template<class T, class V, unsigned int N>
const V operator * (float k, const ArithVec< T, V, N > &v)
 Multiply float onto vector.
template<class T, class V, unsigned int N>
const V operator * (int k, const ArithVec< T, V, N > &v)
 Multiply unsigned int onto vector.
template<class T, class V, unsigned int N>
v_min (const ArithVec< T, V, N > &v0, const ArithVec< T, V, N > &v1)
 Returns the vector containing for each coordinate the smallest value from two vectors.
template<class T, class V, unsigned int N>
v_max (const ArithVec< T, V, N > &v0, const ArithVec< T, V, N > &v1)
 Returns the vector containing for each coordinate the largest value from two vectors.
template<class T, class V>
normalize (const ArithVec2Float< T, V > &v)
 Returns normalized vector.
template<class T, class V>
orthogonal (const ArithVec2Float< T, V > &v)
 Rotates vector 90 degrees to obtain orthogonal vector.
template<class T, class V>
cross (const ArithVec2Float< T, V > &a, const ArithVec2Float< T, V > &b)
template<class T, class V>
bool linear_combine (const ArithVec2Float< T, V > &a, const ArithVec2Float< T, V > &b, const ArithVec2Float< T, V > &c, T &, T &)
 The two last (scalar) arguments are the linear combination of the two first arguments (vectors) which produces the third argument.
template<class T, class V>
cross (const ArithVec3Float< T, V > &x, const ArithVec3Float< T, V > &y)
 Returns cross product of arguments.
template<class T, class V>
void orthogonal (const ArithVec3Float< T, V > &, ArithVec3Float< T, V > &, ArithVec3Float< T, V > &)
 Compute basis of orthogonal plane.
template<class T, class V>
cross (const ArithVec3Int< T, V > &x, const ArithVec3Int< T, V > &y)
 Returns cross product of arguments.
template<class T, class V, unsigned int N>
length (const ArithVecFloat< T, V, N > &v)
 Returns normalized vector.
template<class T, class V, unsigned int N>
normalize (const ArithVecFloat< T, V, N > &v)
 Returns normalized vector.
float cgla_nan ()
double sqrt3 ()
bool isnan (double x)
template<class Scalar>
Scalar s_min (Scalar a, Scalar b)
template<class Scalar>
Scalar s_max (Scalar a, Scalar b)
template<class Scalar>
Scalar sqr (Scalar x)
 Template for a function that squares the argument.
template<class Scalar>
Scalar qbe (Scalar x)
 Scalaremplate for a function that returns the cube of the argument.
template<class Scalar>
bool is_zero (Scalar x)
template<class Scalar>
bool is_tiny (Scalar x)
int two_to_what_power (unsigned int x)
 What power of 2 ?.
int round (float x)
template<class T>
sign (T x)
template<class T>
int_pow (T a, unsigned int n)
 Integer power function with O(log(n)) complexity.
template<class T, class S>
void raw_assign (T &a, const S *b)
 raw_assign takes a CGLA vector, matrix or whatever has a get() function as its first argument and a raw pointer to a (presumed scalar) entity as the second argument.
template<class MT>
int power_eigensolution (const MT &A, MT &Q, MT &L, unsigned int max_sol=1000)
 Use the power method to obtain an eigensolution.
Mat3x3d identity_Mat3x3d ()
 Create an identity matrix.
Mat3x3f rotation_Mat3x3f (CGLA::Axis axis, float angle)
 Create a rotation _matrix. Rotates about one of the major axes.
Mat3x3f scaling_Mat3x3f (const Vec3f &)
 Create a scaling matrix.
Mat3x3f identity_Mat3x3f ()
 Create an identity matrix.
Mat4x4d rotation_Mat4x4d (CGLA::Axis axis, float angle)
 Create a rotation _matrix. Rotates about one of the major axes.
Mat4x4d translation_Mat4x4d (const Vec3d &)
 Create a translation matrix.
Mat4x4d scaling_Mat4x4d (const Vec3d &)
 Create a scaling matrix.
Mat4x4d identity_Mat4x4d ()
 Create an identity matrix.
Mat4x4d invert_ortho (const Mat4x4d &m)
 Compute inverse assuming that the upper-left 3x3 sub-matrix is orthonormal (which is the case if the transformation is only a concatenation of rotations and translations).
Mat4x4f rotation_Mat4x4f (CGLA::Axis axis, float angle)
 Create a rotation _matrix. Rotates about one of the major axes.
Mat4x4f translation_Mat4x4f (const Vec3f &)
 Create a translation matrix.
Mat4x4f scaling_Mat4x4f (const Vec3f &)
 Create a scaling matrix.
Mat4x4f identity_Mat4x4f ()
 Create an identity matrix.
Mat4x4f invert_ortho (const Mat4x4f &m)
 Compute inverse assuming that the upper-left 3x3 sub-matrix is orthonormal (which is the case if the transformation is only a concatenation of rotations and translations).
template<class VT>
VT mean (const std::vector< VT > &vec)
template<class VT, class MT>
VT covariance (const std::vector< VT > &vec, MT &C_out)
 Function that computes the covariance of a set of points.
std::ostream & operator<< (std::ostream &os, const UnitVector &u)
 Inline output operator.

Variables

const int MASKS [33]
const double BIG = 10e+30
 Numerical constant representing something large.
const double MINUTE = 10e-30
 Numerical constant represents something extremely small.
const double TINY = 3e-7
 Numerical constant represents something very small.
const double SMALL = 10e-2
 Numerical constant represents something small.


Detailed Description

Computer Graphics Linear Algebra.

CGLA is a set of numerical C++ vector and matrix classes and class templates designed with computer graphics in mind. CGLA stands for ``Computer Graphics Linear Algebra''.

Let us get right down to the obvious question: Why create another linear algebra package? Well, CGLA evolved from a few matrix and vector classes because I didn't have anything better. Also, I created CGLA to experiment with some template programming techniques. This led to the most important feature of CGLA, namely the fact that all vector types are derived from the same template.

This makes it easy to ensure identical semantics: Since all vectors have inherited, say, the * operator from a common ancestor, it works the same for all of them.

It is important to note that CGLA was designed for Computer Graphics (not numerical computations) and this had a number of implications. Since, in computer graphics we mainly need small vectors of dimension 2,3, or 4 CGLA was designed for vectors of low dimensionality. Moreover, the amount of memory allocated for a vector is decided by its type at compile time. CGLA does not use dynamic memory. CGLA also does not use virtual functions, and most functions are inline. These features all help making CGLA relatively fast.

Of course, other libraries of vector templates for computer graphics exist, but to my knowledge none where the fundamental templates are parametrized w.r.t. dimension as well as type. In other words, we have a template (ArithVec) that gets both type (e.g. float) and dimension (e.g. 3) as arguments. the intended use of this template is as ancestor of concrete types such as Vec3f - a 3D floating point type.

The use of just one template as basis is very important, I believe, since it makes it extremely simple to add new types of vectors. Another very generic template is ArithMat which is a template for matrix classes. (and not necessarily NxN matrices).

From a users perspective CGLA contains a number of vector and matrix classes, a quaternion and some utility classes. In summary, the most important features are

There is a document on CGLA in the GEL documentation. The introduction above was taken from that text.


Typedef Documentation

typedef Vec4f CGLA::Vec3Hf
 

A 3D homogeneous vector is simply a four D vector.

I find this simpler than a special class for homogeneous vectors.


Enumeration Type Documentation

enum CGLA::Axis
 

Useful enum that represents coordiante axes.


Function Documentation

template<class VT, class M>
M adjoint const ArithSqMat4x4Float< VT, M > &   ) 
 

Compute the adjoint of a matrix.

This is the matrix where each entry is the subdeterminant of 'in' where the row and column of the element is removed. Use mostly to compute the inverse

template<class M1, class M2>
void copy_matrix const M1 &  inmat,
M2 &  outmat
 

Copy a matrix to another matrix, cell by cell.

This conversion that takes a const matrix as first argument (source) and a non-const matrix as second argument (destination). The contents of the first matrix is simply copied to the second matrix.

However, if the first matrix is larger than the second, the cells outside the range of the destination are simply not copied. If the destination is larger, the cells outside the range of the source matrix are not touched.

An obvious use of this function is to copy a 3x3 rotation matrix into a 4x4 transformation matrix.

template<class VT, class MT>
VT covariance const std::vector< VT > &  vec,
MT &  C_out
 

Function that computes the covariance of a set of points.

This function returns the mean, and, upon completion, the final argument contains the covariance matrix.

This template is instantiated for Vec3f, Vec2f, and Vec4f.

template<class T, class V>
V cross const ArithVec3Int< T, V > &  x,
const ArithVec3Int< T, V > &  y
[inline]
 

Returns cross product of arguments.

template<class T, class V>
V cross const ArithVec3Float< T, V > &  x,
const ArithVec3Float< T, V > &  y
[inline]
 

Returns cross product of arguments.

template<class V, class M>
double determinant const ArithSqMat4x4Float< V, M > &  m  )  [inline]
 

Compute the determinant of a 4x4 matrix.

The code below is what I found to be most robust. The original implementation used direct computation of the 3x3 sub-determinants and I also tried a direct computation based on enumerating all permutations. The code below is better.

template<class V, class M>
ArithSqMat3x3Float<V,M>::ScalarType determinant const ArithSqMat3x3Float< V, M > &  m  )  [inline]
 

Compute determinant.

There is a more generic function for computing determinants of square matrices (ArithSqMat). This one is faster but works only on Mat3x3f

template<class V, class M>
ArithSqMat2x2Float<V,M>::ScalarType determinant const ArithSqMat2x2Float< V, M > &  m  )  [inline]
 

Compute the determinant of a Mat2x2f.

This function is faster than the generic determinant function for ArithSqMat

template<class T, class V, unsigned int N>
T dot const ArithVec< T, V, N > &  v0,
const ArithVec< T, V, N > &  v1
[inline]
 

Dot product for two vectors.

The `*' operator is reserved for coordinatewise multiplication of vectors.

Mat3x3d identity_Mat3x3d  )  [inline]
 

Create an identity matrix.

Mat3x3f identity_Mat3x3f  )  [inline]
 

Create an identity matrix.

Mat4x4d identity_Mat4x4d  )  [inline]
 

Create an identity matrix.

Mat4x4f identity_Mat4x4f  )  [inline]
 

Create an identity matrix.

template<class T>
T int_pow a,
unsigned int  n
[inline]
 

Integer power function with O(log(n)) complexity.

template<class VT, class M>
M invert const ArithSqMat4x4Float< VT, M > &   ) 
 

Compute the inverse matrix of a Mat4x4f.

template<class V, class M>
M invert const ArithSqMat3x3Float< V, M > &   ) 
 

Invert 3x3 matrix.

template<class VT, class M>
M invert_affine const ArithSqMat4x4Float< VT, M > &   ) 
 

Compute the inverse matrix of a Mat4x4f that is affine.

Mat4x4f invert_ortho const Mat4x4f &  m  )  [inline]
 

Compute inverse assuming that the upper-left 3x3 sub-matrix is orthonormal (which is the case if the transformation is only a concatenation of rotations and translations).

Mat4x4d invert_ortho const Mat4x4d &  m  )  [inline]
 

Compute inverse assuming that the upper-left 3x3 sub-matrix is orthonormal (which is the case if the transformation is only a concatenation of rotations and translations).

template<class T, class V, unsigned int N>
T length const ArithVecFloat< T, V, N > &  v  )  [inline]
 

Returns normalized vector.

template<class T, class V>
bool linear_combine const ArithVec2Float< T, V > &  a,
const ArithVec2Float< T, V > &  b,
const ArithVec2Float< T, V > &  c,
T &  ,
T & 
 

The two last (scalar) arguments are the linear combination of the two first arguments (vectors) which produces the third argument.

template<class VVT, class HVT, class HV1T, class VV2T, class MT1, class MT2, class MT, unsigned int ROWS1, unsigned int ROWS2>
void mul const ArithMatFloat< VVT, HV1T, MT1, ROWS1 > &  m1,
const ArithMatFloat< VV2T, HVT, MT2, ROWS2 > &  m2,
ArithMatFloat< VVT, HVT, MT, ROWS1 > &  m
[inline]
 

Multiply two arbitrary matrices.

In principle, this function could return a matrix, but in general the new matrix will be of a type that is different from either of the two matrices that are multiplied together. We do not want to return an ArithMatFloat - so it seems best to let the return value be a reference arg.

This template can only be instantiated if the dimensions of the matrices match -- i.e. if the multiplication can actually be carried out. This is more type safe than the win32 version below.

template<class T, class V, unsigned int N>
V normalize const ArithVecFloat< T, V, N > &  v  )  [inline]
 

Returns normalized vector.

template<class T, class V>
V normalize const ArithVec2Float< T, V > &  v  )  [inline]
 

Returns normalized vector.

template<class T, class V, unsigned int N>
const V operator * int  k,
const ArithVec< T, V, N > &  v
[inline]
 

Multiply unsigned int onto vector.

See the note in the documentation regarding multiplication of a double onto a vector.

template<class T, class V, unsigned int N>
const V operator * float  k,
const ArithVec< T, V, N > &  v
[inline]
 

Multiply float onto vector.

See the note in the documentation regarding multiplication of a double onto a vector.

template<class T, class V, unsigned int N>
const V operator * double  k,
const ArithVec< T, V, N > &  v
[inline]
 

Multiply double onto vector.

This operator handles the case where the vector is on the righ side of the `*'.

Note:
It seems to be optimal to put the binary operators inside the ArithVec class template, but the operator functions whose left operand is _not_ a vector cannot be inside, hence they are here. We need three operators for scalar * vector although they are identical, because, if we use a separate template argument for the left operand, it will match any type. If we use just T as type for the left operand hoping that other built-in types will be automatically converted, we will be disappointed. It seems that a float * ArithVec<float,Vec3f,3> function is not found if the left operand is really a double.

template<class VT, class MT, unsigned int ROWS>
MT operator * const ArithSqMatFloat< VT, MT, ROWS > &  m1,
const ArithSqMatFloat< VT, MT, ROWS > &  m2
[inline]
 

Multiply two matrices derived from same type, producing a new of same type.

template<class VVT, class HVT, class MT, unsigned int ROWS>
VVT operator * const ArithMatFloat< VVT, HVT, MT, ROWS > &  m,
const HVT &  v
[inline]
 

Multiply vector onto matrix.

template<class VVT, class HVT, class MT, unsigned int ROWS>
const MT operator * int  k,
const ArithMatFloat< VVT, HVT, MT, ROWS > &  v
[inline]
 

Multiply scalar onto matrix.

template<class VVT, class HVT, class MT, unsigned int ROWS>
const MT operator * float  k,
const ArithMatFloat< VVT, HVT, MT, ROWS > &  v
[inline]
 

Multiply scalar onto matrix.

template<class VVT, class HVT, class MT, unsigned int ROWS>
const MT operator * double  k,
const ArithMatFloat< VVT, HVT, MT, ROWS > &  v
[inline]
 

Multiply scalar onto matrix.

std::ostream& operator<< std::ostream &  os,
const UnitVector &  u
[inline]
 

Inline output operator.

template<class T, class V, class Q>
std::ostream& operator<< std::ostream &  os,
const ArithQuat< T, V, Q > &  v
[inline]
 

Print quaternion to stream.

template<class VVT, class HVT, class MT, unsigned int ROWS>
std::ostream& operator<< std::ostream &  os,
const ArithMatFloat< VVT, HVT, MT, ROWS > &  m
[inline]
 

Put to operator.

template<class T, class V, unsigned int N>
std::istream& operator>> std::istream &  is,
ArithVec< T, V, N > &  v
[inline]
 

Get from operator for ArithVec descendants.

template<class VVT, class HVT, class MT, unsigned int ROWS>
std::istream& operator>> std::istream &  is,
const ArithMatFloat< VVT, HVT, MT, ROWS > &  m
[inline]
 

Get from operator.

template<class T, class V>
void orthogonal const ArithVec3Float< T, V > &  ,
ArithVec3Float< T, V > &  ,
ArithVec3Float< T, V > & 
 

Compute basis of orthogonal plane.

Given a vector Compute two vectors that are orthogonal to it and to each other.

template<class T, class V>
V orthogonal const ArithVec2Float< T, V > &  v  )  [inline]
 

Rotates vector 90 degrees to obtain orthogonal vector.

template<class VVT, class HVT, class MT, int ROWS, class BinOp>
void outer_product const VVT &  a,
const HVT &  b,
ArithMatFloat< VVT, HVT, MT, ROWS > &  m,
BinOp  op
 

Compute the outer product of a and b using an arbitrary binary operation: op(a, transpose(b)).

This is a matrix with a::rows and b::columns.

template<class VVT, class HVT, class MT, unsigned int ROWS>
void outer_product const VVT &  a,
const HVT &  b,
ArithMatFloat< VVT, HVT, MT, ROWS > &  m
 

Compute the outer product of a and b: a * transpose(b).

This is a matrix with a::rows and b::columns.

template<class MT>
int power_eigensolution const MT &  A,
MT &  Q,
MT &  L,
unsigned int  max_sol = 1000
 

Use the power method to obtain an eigensolution.

Given a matrix A, the function returns the number of eigensolutions found, and the eigenvectors are stored in Q as the rows, and the corresponding values are stored in the diagonal of L upon return of the function.

The so called power method is used to find the dominant eigenvalue, and the method of deflation is used to find the following values. This restricts this function to work only on symmetric matrices.

DO NOT CALL THIS FUNCTION WITH AN UNSYMMETRIC MATRIX.

The final argument is the number of solutions to find. If only a number of solutions are interesting, use this argument to save cycles.

template<class Scalar>
Scalar qbe Scalar  x  )  [inline]
 

Scalaremplate for a function that returns the cube of the argument.

template<class T, class S>
void raw_assign T &  a,
const S *  b
 

raw_assign takes a CGLA vector, matrix or whatever has a get() function as its first argument and a raw pointer to a (presumed scalar) entity as the second argument.

the contents dereferenced by the pointer is copied to the entity given as first argument.

Mat3x3f rotation_Mat3x3f CGLA::Axis  axis,
float  angle
 

Create a rotation _matrix. Rotates about one of the major axes.

Mat4x4d rotation_Mat4x4d CGLA::Axis  axis,
float  angle
 

Create a rotation _matrix. Rotates about one of the major axes.

Mat4x4f rotation_Mat4x4f CGLA::Axis  axis,
float  angle
 

Create a rotation _matrix. Rotates about one of the major axes.

Mat3x3f scaling_Mat3x3f const Vec3f &   ) 
 

Create a scaling matrix.

Mat4x4d scaling_Mat4x4d const Vec3d &   ) 
 

Create a scaling matrix.

Mat4x4f scaling_Mat4x4f const Vec3f &   ) 
 

Create a scaling matrix.

template<class T, class V, class Q>
Q slerp const ArithQuat< T, V, Q > &  q0,
const ArithQuat< T, V, Q > &  q1,
t
[inline]
 

Perform linear interpolation of two quaternions.

The last argument is the parameter used to interpolate between the two first. SLERP - invented by Shoemake - is a good way to interpolate because the interpolation is performed on the unit sphere.

template<class Scalar>
Scalar sqr Scalar  x  )  [inline]
 

Template for a function that squares the argument.

template<class T, class V, unsigned int N>
T sqr_length const ArithVec< T, V, N > &  v  )  [inline]
 

Compute the sqr length by taking dot product of vector with itself.

template<class VT, class MT, unsigned int ROWS>
MT::ScalarType trace const ArithSqMatFloat< VT, MT, ROWS > &  M  )  [inline]
 

Compute trace. Works only for sq. matrices.

Mat4x4d translation_Mat4x4d const Vec3d &   ) 
 

Create a translation matrix.

Mat4x4f translation_Mat4x4f const Vec3f &   ) 
 

Create a translation matrix.

template<class VT, class MT, unsigned int ROWS>
MT transpose const ArithSqMatFloat< VT, MT, ROWS > &  m  )  [inline]
 

Compute the transpose of a square matrix.

This function returns the transpose of its argument.

template<class VVT, class HVT, class M1T, class M2T, unsigned int ROWS, unsigned int COLS>
void transpose const ArithMatFloat< VVT, HVT, M1T, ROWS > &  m,
ArithMatFloat< HVT, VVT, M2T, COLS > &  m_new
[inline]
 

Transpose.

See the discussion on mul if you are curious as to why I don't simply return the transpose.

int two_to_what_power unsigned int  x  )  [inline]
 

What power of 2 ?.

if x is the argument, find the largest y so that 2^y <= x

template<class T, class V, unsigned int N>
V v_max const ArithVec< T, V, N > &  v0,
const ArithVec< T, V, N > &  v1
[inline]
 

Returns the vector containing for each coordinate the largest value from two vectors.

template<class T, class V, unsigned int N>
V v_min const ArithVec< T, V, N > &  v0,
const ArithVec< T, V, N > &  v1
[inline]
 

Returns the vector containing for each coordinate the smallest value from two vectors.


Variable Documentation

const double CGLA::BIG = 10e+30
 

Numerical constant representing something large.

value is a bit arbitrary

const double CGLA::MINUTE = 10e-30
 

Numerical constant represents something extremely small.

value is a bit arbitrary

const double CGLA::SMALL = 10e-2
 

Numerical constant represents something small.

value is a bit arbitrary

const double CGLA::TINY = 3e-7
 

Numerical constant represents something very small.

value is a bit arbitrary


Generated on Mon Mar 12 15:20:33 2007 for GEL by  doxygen 1.4.1