home oakut


complex.h

namespace oakutil
{
    //-------------------------------
    // A simple Complex number class
    //-------------------------------
    class Complex
    {
    public:
        
        float real, img;

        Complex(float r, float i) 
        {
            real = r;
            img = i;
        }

        Complex operator + (const Complex& c) const
        {
            return Complex(real + c.real, img + c.img);
        }

        Complex operator * (const Complex& c) const
        {
            return Complex(real * c.real - img * c.img, 
                real * c.img + img * c.real);
        }
    };
}
   


SourceForge.net Logo