1 /*! ========================================================================
2 ** Extended Template and Library
3 ** Utility Curve Template Class Implementations
6 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
8 ** This package is free software; you can redistribute it and/or
9 ** modify it under the terms of the GNU General Public License as
10 ** published by the Free Software Foundation; either version 2 of
11 ** the License, or (at your option) any later version.
13 ** This package is distributed in the hope that it will be useful,
14 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ** General Public License for more details.
18 ** === N O T E S ===========================================================
20 ** This is an internal header file, included by other ETL headers.
21 ** You should not attempt to use it directly.
23 ** ========================================================================= */
25 /* === S T A R T =========================================================== */
27 #ifndef __ETL__CURVE_FUNC_H
28 #define __ETL__CURVE_FUNC_H
30 /* === H E A D E R S ======================================================= */
34 /* -- C L A S S E S --------------------------------------------------------- */
36 template <class T, class K=float>
39 T operator()(const T &a,const T &b,const K &t)const
41 return T( (b-a)*t+a );
44 T reverse(const T &x, const T &b, const K &t)const
46 return T( (x-t*b)*(static_cast<K>(1)/(static_cast<K>(1)-t)) );
50 template <class T, class K=float>
51 struct distance_func : public std::binary_function<T, T, K>
53 K operator()(const T &a,const T &b)const
56 return static_cast<K>(delta*delta);
59 K cook(const K &x)const { return x*x; }
60 K uncook(const K &x)const { return sqrt(x); }
64 /* -- E N D ----------------------------------------------------------------- */