arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

TFEval.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------------
00002 //
00003 //   Joe Kniss
00004 //     3-20-03
00005 //                   ________    ____   ___ 
00006 //                  |        \  /    | /  /
00007 //                  +---+     \/     |/  /
00008 //                  +--+|  |\    /|     < 
00009 //                  |  ||  | \  / |  |\  \ 
00010 //                  |      |  \/  |  | \  \ 
00011 //                   \_____|      |__|  \__\
00012 //                       Copyright  2003 
00013 //                      Joe Michael Kniss
00014 //                   <<< jmk@cs.utah.edu >>>
00015 //               "All Your Base are Belong to Us"
00016 //-------------------------------------------------------------------------
00017 
00018 /// TFEval.h
00019 
00020 /// Evaluator strategies for transfer function elements
00021 
00022 #ifndef __SIMIAN_TF_EVAL_DOT_H
00023 #define __SIMIAN_TF_EVAL_DOT_H
00024 
00025 #include <smartptr.h>
00026 #include "TFParams.h"
00027 
00028 /// the domain of input to an evaluator should be
00029 /// normalized (somehow) to [-1,1].  The range of 
00030 /// output will be [0,1].  The evaluator should be
00031 /// max at pos 0, and probably min at -1 and 1
00032 
00033 ////////////////////////////////////////////////////
00034 /// the base (abstract) interface for evaluators
00035 class TFEval : public gutz::Counted {
00036 public:
00037    typedef STF::tfSType Type; 
00038    
00039    virtual ~TFEval() {}
00040 
00041    virtual Type eval(const Type &pos) const = 0;
00042 
00043 protected:
00044    TFEval(){}
00045 
00046 };
00047 
00048 typedef gutz::SmartPtr<TFEval> TFEvalSP;
00049 
00050 ////////////////////////////////////////////////////
00051 /// a gaussian 
00052 class TFEvalGaus : public TFEval {
00053 public:
00054    TFEvalGaus() {}
00055    ~TFEvalGaus() {}
00056 
00057    TFEval::Type eval(const TFEval::Type &pos) const
00058    {
00059       return TFEval::Type(exp(-pos * 3.6));  
00060    }
00061 
00062 };
00063 
00064 ////////////////////////////////////////////////////
00065 /// a linear ramp
00066 class TFEvalLin : public TFEval {
00067 public:
00068    TFEvalLin() {}
00069    ~TFEvalLin() {}
00070 
00071    TFEval::Type eval(const TFEval::Type &pos) const
00072    {
00073       return gutz::clamp(-1 * gutz::g_abs(pos) + 1);
00074    }
00075 
00076 };
00077 
00078 
00079 
00080 #endif
00081 

Send questions, comments, and bug reports to:
jmk