#include <t3d.h>
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:
| |
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... |
|
This function pre-multiplies the given matrix to the current transformation matrix.
Definition at line 81 of file t3d.cpp. References mt. Referenced by Perspective(), RotateBasis(), Scale(), and Translate(). |
|
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.
|
|
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(). |
|
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.
|
|
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 260 of file t3d.cpp. References Accumulate(). |
|
Function to convert an angle from degree to radian.
|
|
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 197 of file t3d.cpp. References Accumulate(). |
|
This function accumulates a scaling transformation to the current transformation matrix.
Definition at line 165 of file t3d.cpp. References Accumulate(). |
|
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 140 of file t3d.cpp. References mt. Referenced by Dsp::ZbfVertex(). |
|
This function accumulates a translation transformation to the current transformation matrix.
Definition at line 181 of file t3d.cpp. References Accumulate(). |
|
Function to compute the cross product between two 3D vectors.
Definition at line 118 of file t3d.h. References T3d::Vec::x, T3d::Vec::y, and T3d::Vec::z. |
|
Function to normalize a 3D vector.
Definition at line 100 of file t3d.h. References T3d::Vec::x, T3d::Vec::y, and T3d::Vec::z. |
|
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 63 of file t3d.cpp. Referenced by Accumulate(), Identity(), and Transform(). |