UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
spline.hpp
1 // spline.hpp
2 // $Id: spline.hpp,v 1.3 2006/10/05 07:48:59 guser4 Exp $
3 //--------------------------------------------------------------------
4 #ifndef SplineH
5 #define SplineH
6 #include <math.h>
7 #include <string.h>
8 #include <math.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 //#include <mix/wenv.h>
12 #include "parspline_service.hpp"
13 //--------------------------------------------------------------------
14 struct XZN
15 {
16 double x;
17 double z;
18 int n;
19 };
20 //-------------------------------------------------------------------
21 int cmpx(const void *p1,const void *p2);
22 int cmpn(const void *p1,const void *p2);
23 //--------------------------------------------------------------------
24 class Spline
25 {
26  double *x,*z,*a1,*a2,*a3,*a4,*dphi3n,*G,*PHI;
27  XZN *xzn;
28  int N,err;
29  double sigma,amax,MinRc;
30  char *strerr;
31  //----------------------------------------------------------------------
33  void DateEditorApproxCubSplineOneD();
34  //--------------------------------------------------------------------------
36  bool Gauss(int N,double **LN,double *P,double *x);
37  //------------------------------------------------
39  void CubSpline();
40  //-----------------------------------------------------------------------
42  void ApproxCubSplineOneD();
43  //--------------------------------------------------------------------------------------------
46  bool PointLineIntersection(double x01,double z01, double x11,double z11,
47  double x02,double z02,double x12,double z12,double &xt,double &zt);
48  //--------------------------------------------------------------------------------------------
51  bool CurveIntersection(double x0,double z0,double x1,double z1,double a,double b,double c,
52  double d, double xn,double rsq, double &xg, double &zg);
53  //--------------------------------------------------------------------------------------------
55  double Angle(double x01,double x11,double z01,double z11,
56  double x02,double x12,double z02,double z12);
57  //------------------------------------------------------------------------
61  double Interval(double x1,double x2,double z1,double z2,int &num);
62  //---------------------------------------------------------------------
63  //---------------------------------------------------------------------
64  public:
65  //---------------------------------------------------------------------
67  Spline();
70  //Spline(int N,double *x,double *z,int N1,double *x1,double *z1,double rc);
71  Spline(int N0,double *x0,double *z0, double minrc, int N1 = 0, double *x1 = NULL, double *z1 = NULL);
72 
73  //-------------------------------------------------------------------------
75  ~Spline();
76  void NewSpline(int N,double *x,double *z,int N1,double *x1,double *z1,double rc);
77  //-------------------------------------------------------------------------------------
82  void GetPoints(int N1,double *x1,double *z1,int flag,int n1=-1,int n2=-1);
83  //--------------------------------------------------------
85  int GetN();
86  //--------------------------------------------------------
90  void GetXZ(double *x1,double *z1);
91  //-------------------------------------------------------
93  void GetABCD(double *a,double *b,double *c,double *d);
94  //------------------------------------------------------------------------
96  double GetSigma();
97  //-------------------------------------------------------------------
99  double GetAmax();
100  //----------------------------------------------------------------------
102  double GetMinRc();
103  //---------------------------------------------------------------
106  bool SplineFunction(double xt,double &zt);
107  //---------------------------------------------------------------
110  bool DerSplineFunction(double xt,double &zt);
111  //---------------------------------------------------------------
114  bool Der2SplineFunction(double xt,double &zt);
115  //---------------------------------------------------------------
118  bool CurvitySplineFunction(double xt,double &zt);
119  //----------------------------------------------------------------------
122  bool RadiusCurvitySplineFunction(double xt,double &zt);
123  //--------------------------------------------------------------------------------------
127  bool SplineIntersection(double x0,double z0,double x1,double z1, double eps,double &xg,
128  double &zg);
129 
130  bool SpIntersect(double x, double z, double x2, double z2, double &resultX, double &resultZ);
131 };
132 //----------------------------------------------------------------------
133 #endif
double GetMinRc()
Method returns spline minimal curvature radius.
int GetN()
Method returns approximated function nodes number.
Definition: spline.hpp:24
bool DerSplineFunction(double xt, double &zt)
Spline()
Constructor by default.
void GetPoints(int N1, double *x1, double *z1, int flag, int n1=-1, int n2=-1)
bool Der2SplineFunction(double xt, double &zt)
void GetABCD(double *a, double *b, double *c, double *d)
Method allows to get N-1 spline coefficients.
bool SplineIntersection(double x0, double z0, double x1, double z1, double eps, double &xg, double &zg)
double GetAmax()
Method returns maximal absolute deviation between spline and initial curve.
bool RadiusCurvitySplineFunction(double xt, double &zt)
Definition: cubspline.hpp:12
bool SplineFunction(double xt, double &zt)
~Spline()
Destructor.
double GetSigma()
Method returns mean-square deviation between spline and initial function.
bool CurvitySplineFunction(double xt, double &zt)
void GetXZ(double *x1, double *z1)
Definition: spline.hpp:14