#include <math.h>
#include "t3d.h"
Include dependency graph for t3d.c:
Go to the source code of this file.
Compounds | |
struct | Vector |
3D vector More... | |
3D transformation module | |
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. See specification of public function in file "t3d.h". --------------------------------------------------------------- Revisions:
| |
#define | rad(a) ((a)*0.01745329252) |
typedef double | Matrix3d [4][4] |
4x4 homogenous coordinate transformation matrix | |
void | t3dVecUnit (Vector *a, Vector *b) |
This function normalizes a given vector to a unit vector and returns the result in another vector. | |
void | t3dVecCross (Vector *a, Vector *b, Vector *c) |
This function returns in the third vector parameter the cross product of the two first vector parameters. | |
void | t3dAccumulate (Matrix3d new_mt) |
This function pre-multiplies the given matrix to the current transformation matrix. | |
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. | |
Matrix3d | mt |
Current transformation matrix. |
|
|
|
4x4 homogenous coordinate transformation matrix
Definition at line 74 of file t3d.c. Referenced by t3dAccumulate(), t3dPerspective(), t3dRotateBasis(), t3dScale(), and t3dTranslate(). |
|
This function pre-multiplies the given matrix to the current transformation matrix.
Definition at line 125 of file t3d.c. Referenced by t3dPerspective(), t3dRotateBasis(), t3dScale(), and t3dTranslate(). |
|
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.
Definition at line 246 of file t3d.c. References t3dRotateBasis(), t3dTranslate(), Vector::x, Vector::y, and Vector::z. |
|
This function sets the current transformation matrix and its inverse as identity matrices.
Definition at line 201 of file t3d.c. References mt. |
|
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.
Definition at line 284 of file t3d.c. References t3dScale(), and t3dTranslate(). |
|
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.
Definition at line 272 of file t3d.c. References Matrix3d, and t3dAccumulate(). |
|
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.
Definition at line 233 of file t3d.c. References Matrix3d, and t3dAccumulate(). Referenced by t3dCamera(). |
|
This function accumulates a scaling transformation to the current transformation matrix.
Definition at line 211 of file t3d.c. References Matrix3d, and t3dAccumulate(). Referenced by t3dNormalizeView(). |
|
This function transforms the given coordinates according to the current transformation matrix. The result of the transformation is divided by the fourth homogeneous coordinate.
Definition at line 186 of file t3d.c. References mt. Referenced by dspZbfVertex(). |
|
This function accumulates a translation transformation to the current transformation matrix.
Definition at line 222 of file t3d.c. References Matrix3d, and t3dAccumulate(). Referenced by t3dCamera(), and t3dNormalizeView(). |
|
This function returns in the third vector parameter the cross product of the two first vector parameters.
|
|
This function normalizes a given vector to a unit vector and returns the result in another vector.
|
|
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 } }
Definition at line 78 of file t3d.c. Referenced by t3dAccumulate(), t3dIdentity(), and t3dTransform(). |