XdkWrl: Transformator Class Reference

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 (unsigned short i, unsigned short j)
float | element (unsigned short i, unsigned short j) const
## Static Public Member Functions
static Transformator | translation (float x, float y, float z)
static Transformator | rotation (float rad, float x, float y, float z)
static Transformator | scaling (float x, float y, float z)
static 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

void loadIdentity | ( |  | ) |

Reset the matrix to identity transformation.

void translate | ( | float | x,
|  | float | y,
|  | float | z |
| ) |  |  |

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

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.

void scale | ( | float | x,
|  | float | y,
|  | float | z |
| ) |  |  |

Add a scaling.

void scale | ( | float | s | ) |

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

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 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 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.

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).

Transformator inverseTranspose | ( |  | ) | const

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

float & element | ( | unsigned short | i,
|  | unsigned short | j |
| ) |  |  | `[inline]`

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

float element | ( | unsigned short | i,
|  | unsigned short | j |
| ) |  |  | const`[inline]`

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

wrl::Transformator translation | ( | float | x,
|  | float | y,
|  | float | z |
| ) |  |  | `[inline, static]`

Returns a transformation object for translation.

wrl::Transformator rotation | ( | float | rad,
|  | float | x,
|  | float | y,
|  | float | z |
| ) |  |  | `[inline, static]`

Returns a transformation object for rotation. Provided for convenience.

wrl::Transformator scaling | ( | float | x,
|  | float | y,
|  | float | z |
| ) |  |  | `[inline, static]`

Returns a transformation object for scaling. Provided for convenience.

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

Returns a transformation object for scaling.

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

## Friends And Related Function Documentation

std::ostream& operator<< | ( | std::ostream & | s,
|  | const wrl::Transformator & | t |
| ) |  |  | `[friend]`

bool operator== | ( | const Transformator & | t0,
|  | const Transformator & | t1 |
| ) |  |  | `[friend]`

Return true iff the 2 transformations are the same.

bool operator!= | ( | const Transformator & | t0,
|  | const Transformator & | t1 |
| ) |  |  | `[friend]`

Return true iff the 2 transformations are different.

bool operator< | ( | const Transformator & | t0,
|  | const Transformator & | t1 |
| ) |  |  | `[friend]`

Provide strict ordering.

Generated on 5 Jan 2007 with version 1.5.1. |