UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
u_smspl3_curve1d.hpp
1 /* u_smspl3_curve1d.hpp */
2 /* $Id$ */
3 #ifndef __u_smspl3_curve1d_hpp
4 #define __u_smspl3_curve1d_hpp
5 
6 #include <vector>
7 #include <mth/u2d_wpoint.hpp>
8 #include <mth/u2d_box.hpp>
9 #include <mth/u_curve1d.hpp>
10 
14 {
15 public:
16 
18  struct Node
19  {
21  Node(double ix = 0., double iw = 0.):
22  x(ix), w(iw) {/* Nothing to do. */};
23 
24  double x;
25  double w;
26  };
27  typedef std::vector<Node> Nodes;
28 
30  USmspl3Curve1d(double alpha = 0);
31 
33  USmspl3Curve1d(const Nodes &nodes, double alpha = 0.);
34 
36  virtual ~USmspl3Curve1d();
37 
38 
40  virtual void approximate(const Nodes &nodes, double alpha = 0.);
41 
43  virtual double operator()(double p) const;
44 
46  virtual bool ready() const
47  {return m_ready;}
48 
49 
52  virtual void addNode(const Node &node, int id)
53  {printf("USmspl3Curve1d::addNode: not implemented.\n");}
54 
56  virtual bool removeNode(size_t id)
57  {printf("USmspl3Curve1d::removeNode: not implemented.\n"); return false;}
58 
59 protected:
60 
62  struct Coeffs
63  {double a,b,c,d,p;};
64  typedef std::vector<Coeffs> CoeffsAr;
65 
67  double m_alpha;
68 
71 
74 
76  bool m_ready;
77 
78  // spline linear system matricies and vectors elements
79  inline double Am(size_t i, size_t j, const Nodes &nodes) const;
80  inline double Hm(size_t i, size_t j, const Nodes &nodes) const;
81  inline double Km(size_t i, size_t j, const Nodes &nodes) const;
82  inline double bv(size_t i, const Nodes &nodes) const;
83 
85  bool calc_coeffs(const Nodes &nodes,
86  double alpha,
87  CoeffsAr &coeffs);
88 
90  inline double get_s(double p) const;
91 
92 private:
93 
94  double m_h_value;
95 };
96 
97 #endif /* u_smspl3_curve1d.hpp */
Definition: u_smspl3_curve1d.hpp:13
USmspl3Curve1d(double alpha=0)
double x
Definition: u_smspl3_curve1d.hpp:22
double get_s(double p) const
Node(double ix=0., double iw=0.)
Definition: u_smspl3_curve1d.hpp:21
virtual double operator()(double p) const
virtual bool removeNode(size_t id)
Definition: u_smspl3_curve1d.hpp:56
virtual void addNode(const Node &node, int id)
Definition: u_smspl3_curve1d.hpp:52
double w
Definition: u_smspl3_curve1d.hpp:25
bool calc_coeffs(const Nodes &nodes, double alpha, CoeffsAr &coeffs)
CoeffsAr m_coeffs
Definition: u_smspl3_curve1d.hpp:70
std::vector< Coeffs > CoeffsAr
Definition: u_smspl3_curve1d.hpp:64
Definition: u2d_box.hpp:8
U2dBox m_bound
Definition: u_smspl3_curve1d.hpp:73
Definition: u_smspl3_curve1d.hpp:18
virtual ~USmspl3Curve1d()
virtual void approximate(const Nodes &nodes, double alpha=0.)
double m_alpha
Definition: u_smspl3_curve1d.hpp:67
virtual bool ready() const
Definition: u_smspl3_curve1d.hpp:46
Definition: u_smspl3_curve1d.hpp:62