UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
u_smooth_cubic_spline1d.hpp
1 /* smooth_cubic_spline1d.hpp */
2 /* $Id$ */
3 #ifndef __u_smooth_cubic_spline1d_hpp
4 #define __u_smooth_cubic_spline1d_hpp
5 
6 #include <vector>
7 #include <mth/u2d_wpoint.hpp>
8 #include <mth/u2d_box.hpp>
9 #include <mth/u_curve1d.hpp>
10 
13 class SmoothCubicSpline1d : public UCurve1d<U2dWPoint>
14 {
15 public:
16 
19 
21  SmoothCubicSpline1d(const U2dWPoints &nodes, double alpha);
22 
24  virtual ~SmoothCubicSpline1d();
25 
26 
28  virtual double operator()(double x) const;
29 
31  virtual void approximate(const U2dWPoints &nodes, double alpha);
32 
34  virtual bool ready() const
35  {return m_ready;}
36 
37 
40  virtual void addNode(const U2dWPoint& /*node*/, int /*id*/)
41  {printf("SmoothCubicSpline1d::addNode: not implemented.\n");}
42 
44  virtual bool removeNode(size_t /*id*/)
45  {printf("SmoothCubicSpline1d::removeNode: not implemented.\n"); return false;}
46 
47 protected:
48 
50  struct Coeffs
51  {double a,b,c,d,x;};
52  typedef std::vector<Coeffs> CoeffsAr;
53 
56 
59 
61  bool m_ready;
62 
63  // spline linear system matricies and vectors elements
64  inline double Am(size_t i, size_t j, const U2dWPoints &nodes) const;
65  inline double Hm(size_t i, size_t j, const std::vector<double> &delta_vec) const;
66  inline double Km(size_t i, size_t j, const U2dWPoints &nodes) const;
67  inline double bv(size_t i, const U2dWPoints &nodes) const;
68 
70  bool calc_coeffs(const U2dWPoints &nodes,
71  double alpha,
72  CoeffsAr &coeffs);
73 
75  inline double get_s(double x) const;
76 
77 private:
78 };
79 
80 #endif /* u_smooth_cubic_spline1d.hpp */
virtual bool ready() const
Definition: u_smooth_cubic_spline1d.hpp:34
double get_s(double x) const
std::vector< Coeffs > CoeffsAr
Definition: u_smooth_cubic_spline1d.hpp:52
virtual double operator()(double x) const
Definition: u_curve1d.hpp:11
virtual void approximate(const U2dWPoints &nodes, double alpha)
Definition: u_smooth_cubic_spline1d.hpp:13
virtual bool removeNode(size_t)
Definition: u_smooth_cubic_spline1d.hpp:44
U2dBox m_bound
Definition: u_smooth_cubic_spline1d.hpp:58
virtual void addNode(const U2dWPoint &, int)
Definition: u_smooth_cubic_spline1d.hpp:40
CoeffsAr m_coeffs
Definition: u_smooth_cubic_spline1d.hpp:55
Definition: u_smooth_cubic_spline1d.hpp:50
Definition: u2d_box.hpp:8
bool calc_coeffs(const U2dWPoints &nodes, double alpha, CoeffsAr &coeffs)
Definition: u2d_wpoint.hpp:9
virtual ~SmoothCubicSpline1d()