Develop and Download Open Source Software

Browse Subversion Repository

Contents of /Plugin/Complex.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (show annotations) (download) (as text)
Wed Feb 10 18:21:00 2010 UTC (14 years, 2 months ago) by sho1get
File MIME type: text/x-chdr
File size: 937 byte(s)


1 #pragma once
2
3 //////////////////////////////////////////////////////////////////////////
4
5 class Complex
6 {
7 public:
8 Complex() : m_dbReal(0.0), m_dbImag(0.0) {}
9 Complex(double dbReal, double dbImag) : m_dbReal(dbReal), m_dbImag(dbImag) {}
10 ~Complex() {}
11
12 double Real() { return m_dbReal; }
13 double Imag() { return m_dbImag; }
14 double Norm() { return (m_dbReal * m_dbReal + m_dbImag * m_dbImag); }
15
16 void Set(double dbReal, double dbImag)
17 {
18 m_dbReal = dbReal;
19 m_dbImag = dbImag;
20 }
21
22 Complex operator +(Complex &c)
23 {
24 return Complex(this->m_dbReal + c.Real(), this->m_dbImag + c.Imag());
25 }
26
27 Complex operator *(Complex &c)
28 {
29 return Complex(this->m_dbReal * c.Real() - this->m_dbImag * c.Imag(),
30 this->m_dbReal * c.Imag() + this->m_dbImag * c.Real());
31 }
32
33 private:
34 double m_dbReal;
35 double m_dbImag;
36 };
37
38 //////////////////////////////////////////////////////////////////////////
39

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26