#include <functional>
+#include "hermite"
+
/* === M A C R O S ========================================================= */
//#ifndef _EPSILON
};
template <typename T>
+class derivative<hermite<T> > : public std::unary_function<typename hermite<T>::argument_type,typename hermite<T>::result_type>
+{
+ hermite<T> func;
+public:
+ explicit derivative(const hermite<T> &x):func(x) { }
+
+ typename hermite<T>::result_type
+ operator()(const typename hermite<T>::argument_type &x)const
+ {
+ T a = func[0], b = func[1], c = func[2], d = func[3];
+ typename hermite<T>::argument_type y(1-x);
+ return ((b-a)*y*y + (c-b)*x*y*2 + (d-c)*x*x) * 3;
+ }
+};
+
+template <typename T>
class integral : public std::binary_function<typename T::argument_type,typename T::argument_type,typename T::result_type>
{
T func;
etl::hermite<Vector> curve(blinepoint0.get_vertex(), blinepoint1.get_vertex(),
blinepoint0.get_tangent2(), blinepoint1.get_tangent1());
- etl::derivative< etl::hermite<Vector> > deriv(curve, 0.0001);
+ etl::derivative< etl::hermite<Vector> > deriv(curve);
switch (get_type())
{
Segment segment((*segment_)(t).get(Segment()));
etl::hermite<Vector> curve(segment.p1,segment.p2,segment.t1,segment.t2);
- etl::derivative< etl::hermite<Vector> > deriv(curve, 0.0001);
+ etl::derivative< etl::hermite<Vector> > deriv(curve);
return deriv((*amount_)(t).get(Real()));
}