Allink  v0.1
MatematicaStruct.h
1 #ifndef MATEMATICASTRUCT_H
2 #define MATEMATICASTRUCT_H
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <math.h>
7 typedef struct {
9  double a0;
11  double Erra0;
13  double a1;
15  double Erra1;
17  double a2;
19  double Erra2;
21  double Minimo;
23  double MinimoY;
24 }PARABOLA;
26 typedef struct {
28  double Uno;
30  double Due;
32  double Tre;
34  double Delta;
36  double Chi;
38  double Min;
40  double Max;
42  double yMin;
44  double yMax;
46  int Num;
47 } MOMENTI;
49 typedef struct {
51  double Rad;
53  double xC;
55  double yC;}CIRCLE;
57 typedef struct {
59  double m;
61  double ErrM;
63  double q;
65  double ErrQ;
67  double Corr;
69  double Cov;
71  double r;
73  double ErrY;
74 }RETTA;
76 typedef struct {
78  double x[3];
79 }VETT;
81 typedef struct {
83  double x[4];
84 }QUADRI;
86 typedef struct {
88  double iLim;
90  double sLim;
92  double Zero;
94  int IfRis;//Se `e andato a buon fine
95 } RADICE;
97 typedef struct {
99  int n;
101  int m;
102 }PERMUTE;
104 typedef struct {
106  double a0;
108  double a1;
110  double a2;
112  double a3;
114  double a4;
115 }SPLINE;
116 //-----------------Spline-----------------
118 class Spline{
119  private:
121  double *Coe;
123  int NCoeff;
124  public:
126  Spline(int N){
127  NCoeff = N;
128  Coe = NULL;
129  Coe = (double*)calloc(N,sizeof(double));
130  if(!Coe)printf("Spline: not allocated\n");
131  };
133  ~Spline(){free(Coe);};
135  int GetN(){return NCoeff;};
137  double GetCoe(int n){
138  if(n<0||n>=NCoeff){printf("Spline: Wrong index\n");
139  return 1.;}
140  return Coe[n];
141  };
143  void SetCoe(double Val,int n){
144  if(n<0||n>=NCoeff){
145  printf("Spline: Wrong index\n");
146  return ;}
147  Coe[n] = Val;};
149  void AddCoe(double Val,int n){
150  if(n<0||n>=NCoeff){
151  printf("Spline: Wrong index\n");return ;}
152  Coe[n] += Val;
153  };
154 };
157  //Stolen from NeHe
158 private:
159  double m_x;
160  double m_y;
161  double m_z;
162  double m_w;
163 public:
164  Quaternione();
165  void AxisRotation(double x,double y,double z,double degrees);
166  void CreateMatrix(double *pMatrix);
167  Quaternione operator *(Quaternione q);
168 
169 };
170 
171 
172 
173 #endif //MATEMATICA_H
double a4
a0 + a1*x + a2*x^2 + a3*x^3 + a4^4
double a1
a0 + a1 x + a2 x^2
double GetCoe(int n)
Print the n coefficient.
coeficients of a N order spline
int m
Second number of the couple.
double Min
Minimum value.
Parabolas coefficients.
void AddCoe(double Val, int n)
Add to the n coefficient.
double xC
x position of the center
double Due
Second moment.
double Tre
Third moment.
double sLim
Superior limit.
double a2
a0 + a1 x + a2 x^2
double MinimoY
Minimum of the parabola.
Three dimentional vector.
double Erra2
Error on the third coefficient.
Indices for the permutation.
double yMin
Minimum of the ordinate.
int n
First number of the couple.
double m
y = m*x + q
int IfRis
If the zero was founds.
double ErrQ
Error on the intercept.
Linear interpolation.
double yMax
Maximum of the ordinate.
double Cov
Covariance.
double a3
a0 + a1*x + a2*x^2 + a3*x^3 + a4^4
Moments of a distribution.
double iLim
Iferior limit.
double Rad
Radius of the circle.
double Zero
Point of the zero.
double r
r factor
double ErrM
Error on the slope.
double Erra0
Error on the first coefficient.
~Spline()
Free the memory.
Quaternion operations.
int GetN()
Print the number of coefficients.
double a2
a0 + a1*x + a2*x^2 + a3*x^3 + a4^4
double a0
a0 + a1 x + a2 x^2
double a1
a0 + a1*x + a2*x^2 + a3*x^3 + a4^4
double ErrY
Error a posteriori.
Where a root was searched.
double Erra1
Error on the second coefficient.
double Minimo
Minimum of the parabola.
double Max
Maximum value.
double Uno
First moment.
Spline(int N)
Allocate the memory.
double Chi
Chi square.
Four dimentional vector/quaternion.
int Num
Number of points considered.
double a0
a0 + a1*x + a2*x^2 + a3*x^3 + a4^4
Radius and center of a circle.
Coefficient of a spline.
double yC
y position of the center
double q
y = m*x + q
double Delta
Step interval.
void SetCoe(double Val, int n)
Set the n coefficient.
double Corr
Correlation.