⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fuzzy.h

📁 fuzzy logsic
💻 H
字号:
// ======================================================= 
// Filename:	fuzzy.h
// Author:		James Matthews.
// Description: A very simple implementation of basic
//				fuzzy logic operators. Basic arithemetric
//				operations are also included to return
//				a fuzzy type. Written for Generation5.
//
//	(http://library.advanced.org/18242/index.shtml)
// =======================================================

// These are only defined here to avoid conflict
// with Microsoft Windows libraries and the STL.
#define fuzmin(a, b)  (((a) < (b)) ? (a) : (b)) 
#define fuzmax(a, b)  (((a) > (b)) ? (a) : (b)) 

class fuzzy {
	public:
		fuzzy() {};
		fuzzy(float f) : m_fNum(f) {}

		fuzzy operator|(float f) { return fuzzy(fuzmax(m_fNum, f)); }
		fuzzy operator&(float f) { return fuzzy(fuzmin(m_fNum, f)); }
		fuzzy operator!()		 { return fuzzy(1 - m_fNum); }
		
		fuzzy operator+(float f) { return fuzzy(m_fNum+f); }
		fuzzy operator-(float f) { return fuzzy(m_fNum-f); }
		fuzzy operator*(float f) { return fuzzy(m_fNum*f); }
		fuzzy operator/(float f) { return fuzzy(m_fNum/f); }

		void operator|=(float f) { m_fNum = fuzmax(m_fNum, f); }
		void operator&=(float f) { m_fNum = fuzmin(m_fNum, f); }

		operator float() { return m_fNum; }

		bool contained(float f) { return (m_fNum <= f); }

	protected:
		float	m_fNum;
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -