_curve_func.h

Go to the documentation of this file.
00001 
00025 /* === S T A R T =========================================================== */
00026 
00027 #ifndef __ETL__CURVE_FUNC_H
00028 #define __ETL__CURVE_FUNC_H
00029 
00030 /* === H E A D E R S ======================================================= */
00031 
00032 #include <functional>
00033 
00034 /* -- C L A S S E S --------------------------------------------------------- */
00035 
00036 template <class T, class K=float>
00037 struct affine_combo
00038 {
00039     T operator()(const T &a,const T &b,const K &t)const
00040     {
00041         return T( (b-a)*t+a );
00042     }
00043 
00044     T reverse(const T &x, const T &b, const K &t)const
00045     {
00046         return T( (x-t*b)*(static_cast<K>(1)/(static_cast<K>(1)-t)) );
00047     }   
00048 };
00049 
00050 template <class T, class K=float>
00051 struct distance_func : public std::binary_function<T, T, K>
00052 {
00053     K operator()(const T &a,const T &b)const
00054     {
00055         T delta=b-a;
00056         return static_cast<K>(delta*delta);
00057     }
00058     
00059     K cook(const K &x)const { return x*x; }
00060     K uncook(const K &x)const { return sqrt(x); }
00061     
00062 };
00063 
00064 /* -- E N D ----------------------------------------------------------------- */
00065 
00066 #endif

Generated on Fri Nov 3 19:48:57 2006 for ETL by  doxygen 1.4.7