fourier_3_1.h

00001 #ifndef __FOURIER_3_1__
00002 #define __FOURIER_3_1__
00003 
00004 #include "fourier_syn.h"
00005 
00006 // Observation (for trefoil) : cos_y = 0, cos_z = 0, sin_x = 0
00007 // AND cos_x[i] = -sin_y[i], cos_x[i+1] = sin_y[i+1]
00008 //
00009 // 3/24 => 1/8 info needed
00010 // cosx cosy cosz sinx siny sinz
00011 // -A 0 0 0 A 0
00012 //  B 0 0 0 B 0
00013 //  0 0 0 0 0 C
00014 class TrefoilFourierKnot : public FourierKnot {
00015 
00016 public:
00017   // Members
00018   float _shift;
00019 
00020   // Constructors
00021   TrefoilFourierKnot();
00022   TrefoilFourierKnot(const char* file);
00023   TrefoilFourierKnot(const TrefoilFourierKnot &tfk);
00024 
00025   TrefoilFourierKnot& operator=(const TrefoilFourierKnot &tfk);
00026   FourierKnot toFourierKnot();
00027   Vector3 operator()(float t) const;
00028   Vector3 prime(float t) const; 
00029   Vector3 primeprime(float t) const;
00030 
00031   void scale(float s);
00032   void shift(float sh);
00033 
00034   // Friend classes
00035   friend ostream& operator<<(ostream &out, const TrefoilFourierKnot &fk);
00036   friend istream& operator>>(istream &in, TrefoilFourierKnot &fk);
00037 };
00038 
00039 // Write trefoil fourier coeffs to stream
00040 inline ostream& operator<<(ostream &out, const TrefoilFourierKnot &fk) {
00041   for (uint i=0;i<fk.csin.size();++i)
00042     out << fk.csin[i] << endl;
00043   return out;
00044 }
00045 
00046 // Read in a trefoil fourier coeff file
00047 // structure :
00048 // sin_y_i sin_y_{i+1} sin_z_{i+2}        // this is 3 rows in the standart fourier coeff file
00049 // ...
00050 inline istream& operator>>(istream &in, TrefoilFourierKnot &fk) {
00051   // csin not used in a trefoil fourier knot
00052   Coeff c;
00053   while ((in >> c)) {
00054     fk.csin.push_back(c);
00055   }
00056   if (in.fail() && !in.eof()) {
00057     cerr << "istream (TrefoilFourierKnot) : Bad input!\n";
00058     exit(1);
00059   };
00060   return in;
00061 }
00062 
00063 
00064 float adjusthelper(float x, float a1=0.01, float h1=0.01, float a2=0.07, float h2=0.005);
00065 float adjust3(float x);
00066 float adjust2(float x);
00067 float adjust(float x);
00068 
00069 #endif // __FOURIER_3_1__

Generated on Mon Feb 8 17:22:35 2010 for libbiarc by  doxygen 1.5.6