Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
CubicSpline.h
1 //
2 // (Natural) Cubic Spline class.
3 //
4 // Originally adapted from some LGPL code found around the net.
5 //
6 // Copyright (c) 2004 Virtual Terrain Project
7 // Free for all uses, see license.txt for details.
8 //
9 
10 #ifndef __CUBIC_SPLINE_H__
11 #define __CUBIC_SPLINE_H__
12 
13 #include <list>
14 #include "MathTypes.h"
15 
21 {
22 public:
23  CubicSpline();
24  virtual ~CubicSpline();
25 
26  void Cleanup();
27  int AddPoint(const DPoint3 &vec);
28  bool Generate();
29  bool Interpolate(double par, DPoint3 *vec,
30  DPoint3 *dvec = NULL, DPoint3 *ddvec = NULL) const;
32  int NumPoints() const { return m_iPoints; }
33 
34 private:
35  std::list<DPoint3> m_veclist;
36 
37  int m_iPoints;
38  DPoint3 *m_pCoeff0;
39  DPoint3 *m_pCoeff1;
40  DPoint3 *m_pCoeff2;
41  DPoint3 *m_pCoeff3;
42 };
43 
44 #endif // __CUBIC_SPLINE_H__
45