Home Hierarchy Members Alphabetical Related Pages

Transformator Class Reference
[Tools]

#include <transformator.h>

List of all members.

Public Member Functions

 Transformator ()
void loadIdentity ()
void translate (float x, float y, float z)
void rotate (float rad, float x, float y, float z)
void scale (float x, float y, float z)
void scale (float s)
void postMultMatrix (const float *m)
void preMultMatrix (const float *m)
void loadMatrix (const float *m)
 operator const float * () const
void getMatrix (float *m) const
void transform (const float *src, float *dst) const
Transformator inverseTranspose () const
float & element (const unsigned short i, const unsigned short j)
float element (const unsigned short i, const unsigned short j) const

Static Public Member Functions

Transformator translation (float x, float y, float z)
Transformator rotation (float rad, float x, float y, float z)
Transformator scaling (float x, float y, float z)
Transformator scaling (float s)

Friends

std::ostream & operator<< (std::ostream &s, const wrl::Transformator &t)
bool operator== (const Transformator &t0, const Transformator &t1)
bool operator!= (const Transformator &t0, const Transformator &t1)
bool operator< (const Transformator &t0, const Transformator &t1)


Detailed Description

Represent a transformation thru a 4x4 matrix. The matrix can be incrementally built using members function to add translation/scaling/rotations. The order of construction is the same than for openGL. So last call is applicated first to point when transformed. In the example below, M et N are transformed in the same way (but notice that t2 reverses its calls).
  float M[3] = { 0.5,1.2,0.7 };
  float N[3] = { 0.5,1.2,0.7 };
  
  Transformator t0;
  Transformator t1;
  t0.rotate(0.3f,1.0f,1.0f,1.0f);
  t1.scale(2.0f,-1.0f,3.0f);
  
  t0.transform(M);
  t1.transform(M);

  Transformator t2;
  t2.scale(2.0f,-1.0f,3.0f);
  t2.rotate(0.3f,1.0f,1.0f,1.0f);
  t2.transform(N);


Constructor & Destructor Documentation

Transformator  ) 
 

Make an indentity transformator


Member Function Documentation

float element const unsigned short  i,
const unsigned short  j
const [inline]
 

Return element on line i and colum j (numbered from 0 to 3).

float & element const unsigned short  i,
const unsigned short  j
[inline]
 

Return element on line i and colum j (numbered from 0 to 3).

void getMatrix float *  m  )  const
 

Copy to m matrix the transformation matrix. In m, the first brackets indicates the lines, the second one the column of the matrix.

Transformator inverseTranspose  )  const
 

Returns a Transformator whose matrix is the inverse transpose of this one.

void loadIdentity  ) 
 

Reset the matrix to identity transformation.

void loadMatrix const float *  m  ) 
 

Loads the m matrix as transformation. In m, the first brackets indicates the lines, the second one the column of the matrix.

operator const float *  )  const [inline]
 

Returns the internal matrix. Convenient alternative to getMAtrix(), especially to work with postMultMatrix and preMultMatrix~:

 Transformator t;
 // ....
 Transformator t2;
 // ...
 t2.postMultMatrix(t1);  // valid code

void postMultMatrix const float *  m  ) 
 

Post multiply the matrix. So M <- M*m. In other words, when transforming a vertex, m will be performed before the current transformation takes place.

You can use a Transformator as argument (see operator const float*()).

void preMultMatrix const float *  m  ) 
 

Pre multiply the matrix. So M <- m*M. In other words, when transforming a vertex, m will be performed after the current transformation takes place.

You can use a Transformator as argument (see operator const float*()).

void rotate float  rad,
float  x,
float  y,
float  z
 

Add a translation around axis (x,y,z) to the current transformation/. Angle angle is in radians. Axis needs not to be normalized.

wrl::Transformator rotation float  rad,
float  x,
float  y,
float  z
[inline, static]
 

Returns a transformation object for rotation. Provided for convenience.

void scale float  s  ) 
 

Provided for convenience. Equivalent to scale(s,s,s)

void scale float  x,
float  y,
float  z
 

Add a scaling.

wrl::Transformator scaling float  s  )  [inline, static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns a transformation object for scaling.

wrl::Transformator scaling float  x,
float  y,
float  z
[inline, static]
 

Returns a transformation object for scaling. Provided for convenience.

void transform const float *  src,
float *  dst
const
 

Apply the transformation to 3 components point src and put the result to dest. This two vectors can be the same (temporary values are used).

void translate float  x,
float  y,
float  z
 

Add a translation of (x,y,z) to the current transformation/

wrl::Transformator translation float  x,
float  y,
float  z
[inline, static]
 

Returns a transformation object for translation.


Friends And Related Function Documentation

bool operator!= const Transformator t0,
const Transformator t1
[friend]
 

bool operator< const Transformator t0,
const Transformator t1
[friend]
 

std::ostream& operator<< std::ostream &  s,
const wrl::Transformator t
[friend]
 

bool operator== const Transformator t0,
const Transformator t1
[friend]
 


Generated on 24 Feb 2005 with doxygen version 1.3.9.1. Valid HTML 4.0! Valid CSS!