Main Page | Alphabetical List | Class List | File List | Class Members | File Members

T3d Class Reference

#include <t3d.h>

List of all members.
Date:
20-Jun-2011
Author:
Luiz F. Martha
Version:
1.0
--------------------------------------------------------------- Reference:

See class notes of courses CIV-2802 Sistemas Graficos para Engenharia, 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.

See specification of public class function in file "t3d.h".

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

  • Version 1.0 by L.F. Martha on 20-Jun-2011: Initial version. Stolen from Trab3 of CIV2801-2005.2 and modified. Incomplete version, to be complete as part of current assignment.


static void Transform (double *x, double *y, double *z)
 This function transforms the given coordinates according to the current transformation matrix.
static void Identity (void)
 This function sets the current transformation matrix and its inverse as identity matrices.
static void Scale (double sx, double sy, double sz)
 This function accumulates a scaling transformation to the current transformation matrix.
static void Translate (double tx, double ty, double tz)
 This function accumulates a translation transformation to the current transformation matrix.
static void RotateBasis (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.
static void Camera (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.
static void Perspective (double d, double front, double back)
 This function accumulates a canonical perspective transformation to the current transformation matrix.
static void NormalizeView (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.
static void Accumulate (double new_mt[4][4])
 This function pre-multiplies the given matrix to the current transformation matrix.
static double mt [4][4]
 Current transformation matrix.

Static Private Member Functions

static double rad (double a)
 Function to convert an angle from degree to radian.
static void VecUnit (Vec *a, Vec *b)
 Function to normalize a 3D vector.
static void VecCross (Vec *a, Vec *b, Vec *c)
 Function to compute the cross product between two 3D vectors.

Classes

struct  Vec
 3D vector struct More...


Member Function Documentation

void T3d::Accumulate double  new_mt[4][4]  )  [static, private]
 

This function pre-multiplies the given matrix to the current transformation matrix.

Parameters:
new_mat - matrix to concatenate to curret matrix (in)

Definition at line 81 of file t3d.cpp.

References mt.

Referenced by Perspective(), RotateBasis(), Scale(), and Translate().

void T3d::Camera double  eyex,
double  eyey,
double  eyez,
double  refx,
double  refy,
double  refz,
double  vupx,
double  vupy,
double  vupz
[static]
 

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 215 of file t3d.cpp.

void T3d::Identity void   )  [static]
 

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

Definition at line 155 of file t3d.cpp.

References mt.

Referenced by Dsp::ZbfModel().

void T3d::NormalizeView double  left,
double  right,
double  bottom,
double  top,
double  front,
double  back
[static]
 

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 287 of file t3d.cpp.

void T3d::Perspective double  d,
double  front,
double  back
[static]
 

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 260 of file t3d.cpp.

References Accumulate().

static double T3d::rad double  a  )  [inline, static, private]
 

Function to convert an angle from degree to radian.

Parameters:
a - given angle (in)
Returns:
angle in radians.

Definition at line 89 of file t3d.h.

void T3d::RotateBasis double  ux,
double  uy,
double  uz,
double  vx,
double  vy,
double  vz,
double  wx,
double  wy,
double  wz
[static]
 

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 197 of file t3d.cpp.

References Accumulate().

void T3d::Scale double  sx,
double  sy,
double  sz
[static]
 

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

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

Definition at line 165 of file t3d.cpp.

References Accumulate().

void T3d::Transform double *  x,
double *  y,
double *  z
[static]
 

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 140 of file t3d.cpp.

References mt.

Referenced by Dsp::ZbfVertex().

void T3d::Translate double  tx,
double  ty,
double  tz
[static]
 

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

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

Definition at line 181 of file t3d.cpp.

References Accumulate().

static void T3d::VecCross Vec a,
Vec b,
Vec c
[inline, static, private]
 

Function to compute the cross product between two 3D vectors.

Parameters:
a,b - given vectors (in)
c - cross product vector (out)

Definition at line 118 of file t3d.h.

References T3d::Vec::x, T3d::Vec::y, and T3d::Vec::z.

static void T3d::VecUnit Vec a,
Vec b
[inline, static, private]
 

Function to normalize a 3D vector.

Parameters:
a - given vector (in)
b - normalized vector (out)

Definition at line 100 of file t3d.h.

References T3d::Vec::x, T3d::Vec::y, and T3d::Vec::z.


Member Data Documentation

double T3d::mt [static, private]
 

Initial value:

 {
  { 1.0, 0.0, 0.0, 0.0 } ,
  { 0.0, 1.0, 0.0, 0.0 } ,
  { 0.0, 0.0, 1.0, 0.0 } ,
  { 0.0, 0.0, 0.0, 1.0 }
 }
Current transformation matrix.

Definition at line 63 of file t3d.cpp.

Referenced by Accumulate(), Identity(), and Transform().


The documentation for this class was generated from the following files:
Generated on Mon Jun 20 18:09:55 2011 for Trab8 by  doxygen 1.4.2-20050421