home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 02 Useful Techniques / 08 Zarozinski / src / ffllapi / MemberFuncSCurve.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-16  |  2.1 KB  |  72 lines

  1. //
  2. // File:    MemberFuncSCurve.h
  3. //
  4. // Purpose:    This class is for the S-Curve shaped member function
  5. //
  6. // Copyright ⌐ 1999-2001 Louder Than A Bomb! Software
  7. //
  8. // This file is part of the FFLL (Free Fuzzy Logic Library) project (http://ffll.sourceforge.net)
  9. // It is released under the BSD license, see http://ffll.sourceforge.net/license.txt for the full text.
  10. //
  11.  
  12. #if !defined(AFX_MemberFuncSCurve_H__DE3C07E3_650E_11D3_B77F_906F59C10001__INCLUDED_)
  13. #define AFX_MemberFuncSCurve_H__DE3C07E3_650E_11D3_B77F_906F59C10001__INCLUDED_
  14.  
  15.  
  16. #include "MemberFuncBase.h"
  17. class MemberFuncTrap;
  18. class MemberFuncSingle;
  19.   
  20. // 
  21. // Class:    MemberFuncSCurve
  22. //
  23. // This is the S-Curve shaped membership function. It consists of 7 points.
  24. // This curve is extreemly flexible and allows some if it's nodes 'y' values
  25. // to be altered.
  26. // 
  27.  
  28. class FFLL_API   MemberFuncSCurve :  virtual public MemberFuncBase  
  29. {
  30.      ////////////////////////////////////////
  31.     ////////// Member Functions ////////////
  32.     ////////////////////////////////////////
  33.  
  34.     public:
  35.  
  36.         // constructor/destructor funcs
  37.         MemberFuncSCurve(); // No function body for this. Explicitly disallow auto-creation of it by the compiler
  38.         MemberFuncSCurve(FuzzySetBase* _parent);
  39.          virtual ~MemberFuncSCurve();
  40.  
  41.         // get functions
  42.         virtual int get_center_x(void) const;
  43.         int get_node_count() const ;
  44.          int get_func_type() const;
  45.  
  46.         // set functions
  47.  
  48.          void set_node(int idx, int x, int y, bool validate = true);
  49.           void set_ramp(int hi_lo_ind, int left_right_ind);
  50.  
  51.         // misc functions
  52.  
  53.           void calc( );
  54.         virtual void expand(int x_delta );
  55.          virtual void shrink(int x_delta );    
  56.  
  57.     protected:
  58.  
  59.         // misc functions
  60.         void init_nodes(int start_x, int term_width);
  61.          void init_nodes(NodePoint p0, NodePoint p1, NodePoint p2);
  62.          void calc_curve_values(NodePoint& p1, NodePoint& p2, NodePoint& p3, NodePoint& p4);
  63.  
  64. }; // end class MemberFuncSCurve
  65.  
  66.  
  67. #else
  68.  
  69. class MemberFuncSCurve; // already defined
  70.  
  71. #endif // !defined(AFX_MemberFuncSCurve_H__DE3C07E3_650E_11D3_B77F_906F59C10001__INCLUDED_)
  72.