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

📄 complex.h

📁 用于声音图像的FFC变换源码
💻 H
字号:
// Complex.h: interface for the CComplex class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_COMPLEX_H__774B1FF0_7414_490F_AB45_53B7AD4EF228__INCLUDED_)
#define AFX_COMPLEX_H__774B1FF0_7414_490F_AB45_53B7AD4EF228__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define PI 3.14159265358979323846

class CComplex
{
public:
	CComplex(const double & Real = 0, const double & Imag = 0):
	  Re(Real), Im(Imag) {}
	CComplex(const CComplex & Rhs):
	  Re(Rhs.Re), Im(Rhs.Im) {}

	~CComplex() {}

	const CComplex & operator=(const CComplex & Rhs);
	const CComplex & operator=(const double & Rhs);
	const CComplex & operator+=(const CComplex & Rhs);
	const CComplex & operator+=(const double & Rhs);
	const CComplex & operator-=(const CComplex & Rhs);
	const CComplex & operator-=(const double & Rhs);
	const CComplex & operator*=(const CComplex & Rhs);
	const CComplex & operator*=(const double & Rhs);
	const CComplex & operator/=(const CComplex & Rhs);
	const CComplex & operator/=(const double & Rhs);

	CComplex operator+(const CComplex &  Rhs) const;
	CComplex operator+(const double &  Rhs) const;
	CComplex operator-(const CComplex &  Rhs) const;
	CComplex operator-(const double &  Rhs) const;
	CComplex operator*(const CComplex &  Rhs) const;
	CComplex operator*(const double &  Rhs) const;
	CComplex operator/(const CComplex &  Rhs) const;
	CComplex operator/(const double &  Rhs) const;

	bool operator!=(const CComplex & Rhs) const;
	bool operator!=(const double & Rhs) const;
	bool operator==(const CComplex & Rhs) const;
	bool operator==(const double & Rhs) const;
	
	CComplex operator-() const;

	double GetReal() {return Re;}
	void SetReal(double Real) {Re = Real;}
	double GetImag() {return Im;}
	void SetImag(double Imag) {Im = Imag;}
	const CComplex & Rotate(double angle);
	const CComplex & Normalize();

	double GetAbs();
	double GetComplexAngle();

private:
	double Re;
	double Im;
};

#endif // !defined(AFX_COMPLEX_H__774B1FF0_7414_490F_AB45_53B7AD4EF228__INCLUDED_)

⌨️ 快捷键说明

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