Files Classes Functions Hierarchy
#include <d3tesstransform.h>
Public Member Functions | |
| void | transEval () |
| Apply trans to all the points in the mesh. | |
| d3tesstransform (d3tess &_tess) | |
| Constructor. | |
| void | rotate (double const theta) |
| Rotate every point about the origin. | |
| void | multiply (pt2c &row1, pt2c &row2) |
| Multiply every point by the transform. | |
| void | translate (pt2c &x) |
| Shift every point in the mesh by x. | |
Public Attributes | |
| d3tess & | tess |
| The tessellation. | |
| d2homogeneous | trans |
| The current transform. | |
There are two ways of using this class. Either use the direct methods to change the mesh or configure trans and call transEval().
The direct methods are simple and as they do not use a 3 by 3 matrix they are more efficient that the homogeneous transform.
But efficiency is relative. The homogeneous trans can have multiple transforms applied to it by multiplying with other d2homogeneous transforms.
It is also easy to pre compute the transform and forever use again by configuring trans and afterwards calling transEval() as opposed for example to using rotate(theta) which re calculates the tranform every time it is called.
Definition at line 31 of file d3tesstransform.h.
| d3tesstransform::d3tesstransform | ( | d3tess & | _tess | ) |
Multiply every point by the transform.
Definition at line 13 of file d3tesstransform.cpp.
References point2< T >::dot(), d3tess::pt, and tess.
Referenced by rotate().
00014 { 00015 vector<pt3> & pt(tess.pt); 00016 uintc sz = pt.size(); 00017 for ( uint i=1; i<sz; ++i ) 00018 { 00019 pt2c w(pt[i]); 00020 pt[i].x = row1.dot(w); 00021 pt[i].y = row2.dot(w); 00022 } 00023 }
| void d3tesstransform::rotate | ( | double const | theta | ) |
Rotate every point about the origin.
Definition at line 36 of file d3tesstransform.cpp.
References multiply().
Referenced by d3meshpartitiondraw::rotate().
00037 { 00038 double const cos_t = cos(theta); 00039 double const sin_t = sin(theta); 00040 pt2c r1(cos_t,-sin_t); 00041 pt2c r2(sin_t,cos_t); 00042 00043 multiply(r1,r2); 00044 }
| void d3tesstransform::transEval | ( | ) |
Apply trans to all the points in the mesh.
Definition at line 47 of file d3tesstransform.cpp.
References d2homogeneous::matrixMultiply(), d3tess::pt, tess, trans, point3< T >::x, point3< T >::y, and point3< T >::z.
00048 { 00049 vector<pt3> & pt(tess.pt); 00050 uintc sz = pt.size(); 00051 point3<double> t; 00052 point3<double> *p; 00053 double c; 00054 for ( uint i=1; i<sz; ++i ) 00055 { 00056 p = & pt[i]; 00057 // Preserve the c value of the point 00058 c = p->z; 00059 t.x = p->x; 00060 t.y = p->y; 00061 // Homogeneous points have 1 as their z value 00062 t.z = 1.0; 00063 00064 trans.matrixMultiply(*p,t); 00065 00066 // Restore the c value of the point 00067 p->z = c; 00068 } 00069 }
| void d3tesstransform::translate | ( | pt2c & | x | ) |
Shift every point in the mesh by x.
Definition at line 25 of file d3tesstransform.cpp.
References d3tess::pt, tess, point2< T >::x, and point2< T >::y.
Referenced by d3meshpartitiondraw::translate().
00026 { 00027 vector<pt3> & pt(tess.pt); 00028 uintc sz = pt.size(); 00029 for ( uint i=1; i<sz; ++i ) 00030 { 00031 pt[i].x += x.x; 00032 pt[i].y += x.y; 00033 } 00034 }
The tessellation.
Definition at line 36 of file d3tesstransform.h.
Referenced by multiply(), transEval(), and translate().
1.5.8