proj home

Files   Classes   Functions   Hierarchy  

d2simplex.cpp

Go to the documentation of this file.
00001 
00002 #include <print.h>
00003 #include <mathlib.h>
00004 
00005 #include <d2simplex.h>
00006 
00007 #include <d2homogeneous.h>
00008 
00009 void d2simplex::translate( pt2c & x )
00010 {
00011   for (uint i=0; i<3; ++i)
00012     v[i] += x; 
00013 }
00014 
00015 
00016 void d2simplex::rotate(doublec theta)
00017 {
00018   point2<double> c(v[0]);
00019   c += v[1];
00020   c += v[2];
00021   c *= (1.0/3.0);
00022 
00023   d2homogeneous R;
00024 
00025   R.setRotateAboutPoint(theta,c);
00026 
00027   for (uint i=0; i<3; ++i)
00028     R.matrixMultiply(v[i]);
00029 
00030 /*
00031   double const cos_t = cos(theta);
00032   double const sin_t = sin(theta);
00033 
00034   pt2c r1(cos_t,-sin_t);
00035   pt2c r2(sin_t,cos_t);
00036 
00037   pt2 z;
00038   for (uint i=0; i<3; ++i)
00039   {
00040     z.x = r1.dot(v[i]);
00041     z.y = r2.dot(v[i]);
00042     v[i] = z;
00043   }
00044 */
00045 
00046 
00047 }
00048 
00049 
00050 
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 

Generated on Fri Mar 4 00:49:27 2011 for Chelton Evans Source by  doxygen 1.5.8