00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Mark Alexander 00008 * Side Effects Software Inc 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: UT_Complex.h ( UT Library, C++) 00015 * 00016 * COMMENTS: 00017 * 00018 * Defines a complex number and some simple complex operations. 00019 * 00020 */ 00021 00022 #ifndef __UT_COMPLEX__ 00023 #define __UT_COMPLEX__ 00024 00025 #include "UT_API.h" 00026 00027 #include <SYS/SYS_Types.h> 00028 class UT_API UT_Complex 00029 { 00030 public: 00031 UT_Complex(); 00032 UT_Complex(fpreal64 r,fpreal64 i); 00033 UT_Complex(const UT_Complex &); 00034 00035 void set(fpreal64 r,fpreal64 i); 00036 00037 UT_Complex & operator=(const UT_Complex &); 00038 int operator==(const UT_Complex &) const; 00039 00040 UT_Complex operator+(fpreal64) const; 00041 UT_Complex operator+(const UT_Complex &) const; 00042 UT_Complex operator-(fpreal64) const; 00043 UT_Complex operator-(const UT_Complex &) const; 00044 00045 UT_Complex operator*(fpreal64) const; 00046 UT_Complex operator*(const UT_Complex &) const; 00047 UT_Complex operator/(fpreal64) const; 00048 UT_Complex operator/(const UT_Complex &) const; 00049 00050 UT_Complex pow(fpreal64 exp) const; 00051 00052 float real() const { return myReal; } 00053 float imaginary() const { return myImag; } 00054 00055 fpreal64 magnitude() const; 00056 fpreal64 magnitude2() const; 00057 00058 // Phase is returned in radians 00059 fpreal64 phase() const; 00060 00061 00062 private: 00063 fpreal64 myReal; 00064 fpreal64 myImag; 00065 }; 00066 00067 #endif 00068
1.5.9