GEL  2
GEL is a library for Geometry and Linear Algebra
Classes | Typedefs | Enumerations | Functions | Variables
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
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  ArithVec4Int
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  Vec4i
 4D integer vector. More...
class  Vec4uc
 4D unsigned char vector. More...

Typedefs

typedef Quatf Quaternion
typedef Vec4f Vec3Hf
typedef unsigned char UChar
typedef unsigned short int USInt

Enumerations

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

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)
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)
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)
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)
template<class M1 , class M2 >
void copy_matrix (const M1 &inmat, M2 &outmat)
template<class VVT , class HVT , class MT , unsigned int ROWS>
std::ostream & operator<< (std::ostream &os, const ArithMatFloat< VVT, HVT, MT, ROWS > &m)
template<class VVT , class HVT , class MT , unsigned int ROWS>
std::istream & operator>> (std::istream &is, const ArithMatFloat< VVT, HVT, MT, ROWS > &m)
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)
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)
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 Mat3x3f invert (const ArithSqMat3x3Float< Vec3f, Mat3x3f > &)
template Mat3x3d invert (const ArithSqMat3x3Float< Vec3d, Mat3x3d > &)
template<class V , class M >
ArithSqMat3x3Float< V, M >
::ScalarType 
determinant (const ArithSqMat3x3Float< V, M > &m)
template<class V , class M >
invert_affine (const ArithSqMat4x4Float< V, M > &this_mat)
template<class V , class M >
adjoint (const ArithSqMat4x4Float< V, M > &in)
template<class V , class M >
invert (const ArithSqMat4x4Float< V, M > &in)
template Mat4x4f adjoint (const ArithSqMat4x4Float< Vec4f, Mat4x4f > &)
template Mat4x4f invert (const ArithSqMat4x4Float< Vec4f, Mat4x4f > &)
template Mat4x4f invert_affine (const ArithSqMat4x4Float< Vec4f, Mat4x4f > &)
template Mat4x4d adjoint (const ArithSqMat4x4Float< Vec4d, Mat4x4d > &)
template Mat4x4d invert (const ArithSqMat4x4Float< Vec4d, Mat4x4d > &)
template Mat4x4d invert_affine (const ArithSqMat4x4Float< Vec4d, Mat4x4d > &)
template<class VT , class M >
adjoint (const ArithSqMat4x4Float< VT, M > &)
template<class V , class M >
double determinant (const ArithSqMat4x4Float< V, M > &m)
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)
template<class VT , class MT , unsigned int ROWS>
MT transpose (const ArithSqMatFloat< VT, MT, ROWS > &m)
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)
template<class T , class V , unsigned int N>
sqr_length (const ArithVec< T, V, N > &v)
template<class T , class V , unsigned int N>
const V operator* (double k, const ArithVec< T, V, N > &v)
template<class T , class V , unsigned int N>
const V operator* (float k, const ArithVec< T, V, N > &v)
template<class T , class V , unsigned int N>
const V operator* (int k, const ArithVec< T, V, N > &v)
template<class T , class V , unsigned int N>
v_min (const ArithVec< T, V, N > &v0, const ArithVec< T, V, N > &v1)
template<class T , class V , unsigned int N>
v_max (const ArithVec< T, V, N > &v0, const ArithVec< T, V, N > &v1)
template<class T , class V >
bool linear_combine (const ArithVec2Float< T, V > &a, const ArithVec2Float< T, V > &b, const ArithVec2Float< T, V > &c, T &x, T &y)
template bool linear_combine< double, Vec2d > (const ArithVec2Float< double, Vec2d > &, const ArithVec2Float< double, Vec2d > &, const ArithVec2Float< double, Vec2d > &, double &, double &)
template bool linear_combine< float, Vec2f > (const ArithVec2Float< float, Vec2f > &, const ArithVec2Float< float, Vec2f > &, const ArithVec2Float< float, Vec2f > &, float &, float &)
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 >
void orthogonal (const ArithVec3Float< T, V > &_a, ArithVec3Float< T, V > &b, ArithVec3Float< T, V > &c)
template void orthogonal< float, Vec3f > (const ArithVec3Float< float, Vec3f > &a, ArithVec3Float< float, Vec3f > &b, ArithVec3Float< float, Vec3f > &c)
template void orthogonal< double, Vec3d > (const ArithVec3Float< double, Vec3d > &a, ArithVec3Float< double, Vec3d > &b, ArithVec3Float< double, Vec3d > &c)
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 >
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)
 Scalar template 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)
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.
void gel_srand (unsigned int seed)
 Function that seeds the GEL pseudo-random number generator.
unsigned int gel_rand (unsigned int k)
unsigned int gel_rand ()
template<class T , class S >
void raw_assign (T &a, const S *b)
template int power_eigensolution< Mat2x2f > (const Mat2x2f &, Mat2x2f &, Mat2x2f &, unsigned int)
template int power_eigensolution< Mat3x3f > (const Mat3x3f &, Mat3x3f &, Mat3x3f &, unsigned int)
template int power_eigensolution< Mat4x4f > (const Mat4x4f &, Mat4x4f &, Mat4x4f &, unsigned int)
template int power_eigensolution< Mat2x2d > (const Mat2x2d &, Mat2x2d &, Mat2x2d &, unsigned int)
template int power_eigensolution< Mat3x3d > (const Mat3x3d &, Mat3x3d &, Mat3x3d &, unsigned int)
template int power_eigensolution< Mat4x4d > (const Mat4x4d &, Mat4x4d &, Mat4x4d &, unsigned int)
Mat3x3d rotation_Mat3x3d (CGLA::Axis axis, double angle)
 Create a rotation _matrix. Rotates about one of the major axes.
Mat3x3d scaling_Mat3x3d (const Vec3d &)
 Create a scaling matrix.
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)
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)
template<class VT , class MT >
VT covariance (const vector< VT > &vec, MT &C_out)
template Vec2f covariance< Vec2f, Mat2x2f > (const vector< Vec2f > &vec, Mat2x2f &C_out)
template Vec3f covariance< Vec3f, Mat3x3f > (const vector< Vec3f > &vec, Mat3x3f &C_out)
template Vec4f covariance< Vec4f, Mat4x4f > (const vector< Vec4f > &vec, Mat4x4f &C_out)
template Vec2d covariance< Vec2d, Mat2x2d > (const vector< Vec2d > &vec, Mat2x2d &C_out)
template Vec3d covariance< Vec3d, Mat3x3d > (const vector< Vec3d > &vec, Mat3x3d &C_out)
template Vec4d covariance< Vec4d, Mat4x4d > (const vector< Vec4d > &vec, Mat4x4d &C_out)
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)
std::ostream & operator<< (std::ostream &os, const UnitVector &u)
 Inline output operator.

Variables

const int MASKS [33]
const double BIG = 10e+30
const double MINUTE = 10e-30
const double TINY = 3e-7
const double SMALL = 10e-2
const unsigned int GEL_RAND_MAX = UINT_MAX

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

A 3D homogeneous vector is simply a four D vector. I find this simpler than a special class for homogeneous vectors.


Function Documentation

template<class VT , class M >
M CGLA::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 CGLA::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 CGLA::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 V , class M >
ArithSqMat2x2Float<V,M>::ScalarType CGLA::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 V , class M >
ArithSqMat3x3Float<V,M>::ScalarType CGLA::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 >
double CGLA::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 T , class V , unsigned int N>
T CGLA::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.

unsigned int CGLA::gel_rand ( unsigned int  k)

GEL provides a linear congruential pseudo-random number generator which is optimized for speed. This version allows an integer argument which is useful for grid-based noise functions.

unsigned int CGLA::gel_rand ( )

GEL provides a linear congruential pseudo-random number generator which is optimized for speed. This means that GEL_RAND_MAX==UINT_MAX.

Mat4x4f CGLA::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 CGLA::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 >
bool CGLA::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 CGLA::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 VT , class MT , unsigned int ROWS>
MT CGLA::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 T , class V , unsigned int N>
const V CGLA::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 T , class V , unsigned int N>
const V CGLA::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 CGLA::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 VVT , class HVT , class MT , unsigned int ROWS>
std::ostream& CGLA::operator<< ( std::ostream &  os,
const ArithMatFloat< VVT, HVT, MT, ROWS > &  m 
) [inline]

Put to operator

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

Get from operator

template<class T , class V >
void CGLA::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 VVT , class HVT , class MT , unsigned int ROWS>
void CGLA::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 VVT , class HVT , class MT , int ROWS, class BinOp >
void CGLA::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 T , class S >
void CGLA::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.

template<class T , class V , class Q >
Q CGLA::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 T , class V , unsigned int N>
T CGLA::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 CGLA::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 CGLA::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 CGLA::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 CGLA::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 CGLA::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 unsigned int CGLA::GEL_RAND_MAX = UINT_MAX

The GEL pseudo-random number generator uses UINT_MAX as RAND_MAX to avoid mod operations.

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

 All Classes Namespaces Files Functions Variables Typedefs Enumerations