Allink  v0.1
MatematicaStruct.h
00001 #ifndef MATEMATICASTRUCT_H
00002 #define MATEMATICASTRUCT_H
00003 #include <stdio.h>
00004 #include <stdlib.h>
00005 #include <math.h>
00007 typedef struct {
00009   double a0;
00011   double Erra0;
00013   double a1;
00015   double Erra1;
00017   double a2;
00019   double Erra2;
00021   double Minimo;
00023   double MinimoY;
00024 }PARABOLA;
00026 typedef struct {
00028   double Uno;
00030   double Due;
00032   double Tre;
00034   double Delta;
00036   double Chi;
00038   double Min;
00040   double Max;
00042   double yMin;
00044   double yMax;
00046   int Num;
00047 } MOMENTI;
00049 typedef struct {
00051   double Rad;
00053   double xC;
00055   double yC;}CIRCLE;
00057 typedef struct {
00059   double m;
00061   double ErrM;
00063   double q;
00065   double ErrQ;
00067   double Corr;
00069   double Cov;
00071   double r;
00073   double ErrY;
00074 }RETTA;
00076 typedef struct {
00078   double x[3];
00079 }VETT;
00081 typedef struct {
00083   double x[4];
00084 }QUADRI;
00086 typedef struct {
00088   double iLim;
00090   double sLim;
00092   double Zero;
00094   int IfRis;//Se `e andato a buon fine
00095 } RADICE;
00097 typedef struct {
00099   int n;
00101   int m;
00102 }PERMUTE;
00104 typedef struct {
00106   double a0;
00108   double a1;
00110   double a2;
00112   double a3;
00114   double a4;
00115 }SPLINE;
00116 //-----------------Spline-----------------
00118 class Spline{
00119  private:
00121   double *Coe;
00123   int NCoeff;
00124  public:
00126   Spline(int N){
00127     NCoeff = N;
00128     Coe = NULL;
00129     Coe = (double*)calloc(N,sizeof(double));
00130     if(!Coe)printf("Spline: not allocated\n");
00131   };
00133   ~Spline(){free(Coe);};
00135   int GetN(){return NCoeff;};
00137   double GetCoe(int n){
00138     if(n<0||n>=NCoeff){printf("Spline: Wrong index\n");
00139       return 1.;} 
00140     return Coe[n];
00141   };
00143   void SetCoe(double Val,int n){
00144     if(n<0||n>=NCoeff){
00145       printf("Spline: Wrong index\n");
00146       return ;} 
00147     Coe[n] = Val;};
00149   void AddCoe(double Val,int n){
00150     if(n<0||n>=NCoeff){
00151       printf("Spline: Wrong index\n");return ;} 
00152     Coe[n] += Val;
00153   };
00154 };
00156 class Quaternione{
00157   //Stolen from NeHe
00158 private:
00159   double m_x;
00160   double m_y;
00161   double m_z;
00162   double m_w;
00163 public:
00164   Quaternione();
00165   void AxisRotation(double x,double y,double z,double degrees);
00166   void CreateMatrix(double *pMatrix);
00167   Quaternione operator *(Quaternione q);
00168 
00169 };
00170 
00171 
00172 
00173 #endif //MATEMATICA_H