fourier_3_1.h
00001 #ifndef __FOURIER_3_1__
00002 #define __FOURIER_3_1__
00003
00004 #include "fourier_syn.h"
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 class TrefoilFourierKnot : public FourierKnot {
00015
00016 public:
00017
00018 float _shift;
00019
00020
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
00035 friend ostream& operator<<(ostream &out, const TrefoilFourierKnot &fk);
00036 friend istream& operator>>(istream &in, TrefoilFourierKnot &fk);
00037 };
00038
00039
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
00047
00048
00049
00050 inline istream& operator>>(istream &in, TrefoilFourierKnot &fk) {
00051
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__