synfig-core  1.0.3
valuenode_derivative.h
Go to the documentation of this file.
1 /* === S Y N F I G ========================================================= */
21 /* ========================================================================= */
22 
23 /* === S T A R T =========================================================== */
24 
25 #ifndef __SYNFIG_VALUENODE_DERIVATIVE_H
26 #define __SYNFIG_VALUENODE_DERIVATIVE_H
27 
28 /* === H E A D E R S ======================================================= */
29 
30 #include <synfig/valuenode.h>
31 
32 /* === M A C R O S ========================================================= */
33 
34 /* === C L A S S E S & S T R U C T S ======================================= */
35 
36 namespace synfig {
37 
38 // Class ValueNode_Derivative
39 // Implementation of a derivateive based on finite diferences
40 // See: http://en.wikipedia.org/wiki/Finite_difference
41 // and http://en.wikipedia.org/wiki/Finite_difference_coefficients
42 
44 {
45 
46  ValueNode::RHandle link_; // Value Node whom is calculated the derivative
47  ValueNode::RHandle interval_; // Size of the interval to calculate the finite differences
48  ValueNode::RHandle accuracy_; // Accuracy order
49  ValueNode::RHandle order_; // First or Second order derivative
50 
51  ValueNode_Derivative(const ValueBase &value);
52 
53 public:
54 
55  enum Accuracy
56  {
57  ROUGH =0,
58  NORMAL =1,
59  FINE =2,
61  };
62  enum Order
63  {
64  FIRST =0,
65  SECOND =1
66  };
67  typedef etl::handle<ValueNode_Derivative> Handle;
68  typedef etl::handle<const ValueNode_Derivative> ConstHandle;
69 
70  virtual ValueBase operator()(Time t)const;
71 
72  virtual ~ValueNode_Derivative();
73 
74  virtual String get_name()const;
75  virtual String get_local_name()const;
76 
77  virtual ValueNode::LooseHandle get_link_vfunc(int i)const;
78 
79 protected:
81  virtual bool set_link_vfunc(int i,ValueNode::Handle x);
82 
83 public:
85 
87  static bool check_type(Type &type);
88  static ValueNode_Derivative* create(const ValueBase &x);
89  virtual Vocab get_children_vocab_vfunc()const;
90 }; // END of class ValueNode_Derivative
91 
92 }; // END of namespace synfig
93 
94 /* === E N D =============================================================== */
95 
96 #endif