Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

t3d.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

3D transformation module

Date:
08-Nov-2005
Author:
Luiz F. Martha
Version:
1.0
--------------------------------------------------------------- Reference:

See class notes of courses CIV-2801 Fundamentos de Computacao Grafica Aplicada, Departamento de Engenharia Civil, PUC-Rio.

--------------------------------------------------------------- Functionality:

This package maintains a 3D transformation 4x4 matrix which can be initialized as the identity matrix, and which accumulates the usual 3D geometric transformations and 3D visualization transformations.

There is a public function to transform a given 3D point according to the current transformation matrix.

The 3D transformations considered are scaling, translation, rotation of basis, camera transformation, perspective projection, and view volume normalization. There is a public function for each one of these transformations. The effect of these functions is to accumulate the corresponding transformation in the current transformation matrix.

--------------------------------------------------------------- Revisions:

  • Report modifications here (including name and date).


void t3dTransform (double *x, double *y, double *z)
 This function transforms the given coordinates according to the current transformation matrix.

void t3dIdentity (void)
 This function sets the current transformation matrix and its inverse as identity matrices.

void t3dScale (double sx, double sy, double sz)
 This function accumulates a scaling transformation to the current transformation matrix.

void t3dTranslate (double tx, double ty, double tz)
 This function accumulates a translation transformation to the current transformation matrix.

void t3dRotateBasis (double ux, double uy, double uz, double vx, double vy, double vz, double wx, double wy, double wz)
 This function accumulates a rotation of basis transformation to the current transformation matrix.

void t3dCamera (double eyex, double eyey, double eyez, double refx, double refy, double refz, double vupx, double vupy, double vupz)
 This function accumulates a camara transformation to the current transformation matrix.

void t3dPerspective (double d, double front, double back)
 This function accumulates a canonical perspective transformation to the current transformation matrix.

void t3dNormalizeView (double left, double right, double bottom, double top, double front, double back)
 This function accumulates a view volume normalization transformation to the current transformation matrix.


Function Documentation

void t3dCamera double    eyex,
double    eyey,
double    eyez,
double    refx,
double    refy,
double    refz,
double    vupx,
double    vupy,
double    vupz
 

This function accumulates a camara transformation to the current transformation matrix.

The camara transformation is a change-of-basis transformation formed by a concatenation of a translation from the origin of the world (client) coordinate sytem to the eye point and a rotation from the world coordinate system to the eye coordinate system (a right-handed system centered at the eye point, with the z axis from the reference point to the eye point). The given view upper vector defines with the view direction (eye system z axis, going from the reference point to the eye point) the eye system yz plane.

Parameters:
eyex, eyey, eyez  - eye position (in)
refx, refy, refz  - reference point position (in)
vupx, vupy, vupz  - view up vector direction (in)

Definition at line 246 of file t3d.c.

References t3dRotateBasis(), t3dTranslate(), Vector::x, Vector::y, and Vector::z.

void t3dIdentity void   
 

This function sets the current transformation matrix and its inverse as identity matrices.

Definition at line 201 of file t3d.c.

References mt.

void t3dNormalizeView double    left,
double    right,
double    bottom,
double    top,
double    front,
double    back
 

This function accumulates a view volume normalization transformation to the current transformation matrix.

This normalization is such that it transforms a view volume defined in the eye (camera) coordinate system into a cube whose center is at the origin and whose coordinates are in the range from -1 to +1. The given view volume defines, in the eye coordinate system, the portion of modeling space which is seen on the screen. That is, all points lying ouside the view volume are clipped. It is assumed that both values for the deepness clipping plane positions are positive and that the visible part of the 3D space lies along the negative side of the z-axis in the eye coordinate system. The normalization transformation is such that points at the front clipping plane will have z- coordinates equal to -1 and points at the back clipping plane will have z-coordinates equal to +1. Therefore, there is a reflection transformation with respect to the xy plane in the view volume normalization transformation.

Parameters:
left, right  - horizontal clipping limits of view volume (in)
bottom, top  - vertical clipping limits of view volume (in)
front, back  - deepness clipping limits of view volume (in)

Definition at line 284 of file t3d.c.

References t3dScale(), and t3dTranslate().

void t3dPerspective double    d,
double    front,
double    back
 

This function accumulates a canonical perspective transformation to the current transformation matrix.

This transformation defines a conical projection whose center of projection is assumed as the origin of the system of coordinates. Alternatively, this transformation defines a distortion of the coordinate space such that the result of a orthographic projection of the point in the distorted space coincides with the result of the conical projection. The plane of projection and the two frustum clipping planes (front and back) are assumed normal to the z axis, lying on its negative side. These planes are defined by their distances to the origin. It is assumed that both values for the clipping plane positions are positive and that the visible part of the 3D space lies along the negative side of the z-axis in the eye coordinate system. The perspective distortion is such that it does not change z coordinate values of points lying on the two frustum clipping planes.

Parameters:
d  - distance of projection plane to origin (in)
front  - frustum front clipping plane position (in)
back  - frustum back clipping plane position (in)

Definition at line 272 of file t3d.c.

References Matrix3d, and t3dAccumulate().

void t3dRotateBasis double    ux,
double    uy,
double    uz,
double    vx,
double    vy,
double    vz,
double    wx,
double    wy,
double    wz
 

This function accumulates a rotation of basis transformation to the current transformation matrix.

The rotation of basis is a rotation transformation whose matrix is such that each row of the 3x3 linear transformation submatrix is formed by the given new basis unitary vector coordinates.

Parameters:
ux, uy, uz, vx, vy, vz, wx, wy, wz  - coordinates of unitary vector directions of the three new basis axes. (in)

Definition at line 233 of file t3d.c.

References Matrix3d, and t3dAccumulate().

Referenced by t3dCamera().

void t3dScale double    sx,
double    sy,
double    sz
 

This function accumulates a scaling transformation to the current transformation matrix.

Parameters:
sx, sy, sz  - scaling parameters (in)

Definition at line 211 of file t3d.c.

References Matrix3d, and t3dAccumulate().

Referenced by t3dNormalizeView().

void t3dTransform double *    x,
double *    y,
double *    z
 

This function transforms the given coordinates according to the current transformation matrix.

The result of the transformation is divided by the fourth homogeneous coordinate.

Parameters:
x, y, z  - coordinates of transformed point (in/out)

Definition at line 186 of file t3d.c.

References mt.

Referenced by dspZbfVertex().

void t3dTranslate double    tx,
double    ty,
double    tz
 

This function accumulates a translation transformation to the current transformation matrix.

Parameters:
tx, ty, tz  - translation parameters (in)

Definition at line 222 of file t3d.c.

References Matrix3d, and t3dAccumulate().

Referenced by t3dCamera(), and t3dNormalizeView().


Generated on Tue Nov 8 10:58:09 2005 for Trab3 by doxygen1.2.18