VR-Forces 4.1 Class Documentation
vrfcomplex.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2002 MaK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: vrfcomplex.h,v $ $Revision: 1.3 $ $State: Exp $
7 *******************************************************************************/
8 
11 
12 #ifndef _DtComplex_H_
13 #define _DtComplex_H_
14 
15 #include <vlutil/vlUtil.h>
16 
20 
21 #include "vrfutil/vrfutilDefines.h"
23 {
24  public:
27  DtComplex (void) {};
29  DtComplex (double realPart, double imagPart)
30  : myRealPart (realPart), myImagPart (imagPart)
31  {};
33  DtComplex (const DtComplex& orig)
34  : myRealPart (orig.myRealPart), myImagPart (orig.myImagPart)
35  {};
36 
38  const DtComplex & operator= (const DtComplex& orig);
39 
40  double realPart (void) const {return myRealPart;};
41  double imagPart (void) const {return myImagPart;};
42  double magnitude (void) const
43  {return ::sqrt (myRealPart * myRealPart + myImagPart * myImagPart);};
44  double angle (void) const {return atan2 (myImagPart, myRealPart);};
45 
48  void conjugate (DtComplex * result) const
49  {result->myRealPart = myRealPart;
50  result->myImagPart = - myImagPart;
51  };
52 
53  void negate (DtComplex * result) const
54  {result->myRealPart = -myRealPart;
55  result->myImagPart = -myImagPart;
56  };
57 
59  void sqrt (DtComplex * result) const;
60  void pow (DtComplex * result, int exponent) const;
61 
64  void add (DtComplex * result, const DtComplex& other) const
65  {result->myRealPart = myRealPart + other.myRealPart;
66  result->myImagPart = myImagPart + other.myImagPart;
67  };
68 
69  void subtract (DtComplex * result, const DtComplex& other) const
70  {result->myRealPart = myRealPart - other.myRealPart;
71  result->myImagPart = myImagPart - other.myImagPart;
72  };
73 
74  void multiply (DtComplex * result, const DtComplex& other) const
75  {result->myRealPart =
76  myRealPart * other.myRealPart - myImagPart * other.myImagPart;
77  result->myImagPart =
78  myRealPart * other.myImagPart + myImagPart * other.myRealPart;
79  };
80 
81  void divide (DtComplex * result, double denom) const
82  {result->myRealPart = myRealPart / denom;
83  result->myImagPart = myImagPart / denom;
84  };
85 
86  void divide (DtComplex * result, const DtComplex& other) const;
87 
89  void add (DtComplex * result,
90  const DtComplex& first,
91  const DtComplex& second) const;
92 
93  void add (DtComplex * result,
94  const DtComplex& first,
95  const DtComplex& second,
96  const DtComplex& third) const;
97 
98  void add (DtComplex * result,
99  const DtComplex& first,
100  const DtComplex& second,
101  const DtComplex& third,
102  const DtComplex& fourth) const;
103 
104  void multiply (DtComplex * result,
105  const DtComplex& first,
106  const DtComplex& second) const;
107 
108  void multiply (DtComplex * result,
109  const DtComplex& first,
110  const DtComplex& second,
111  const DtComplex& third) const;
112 
113  void multiply (DtComplex * result,
114  const DtComplex& first,
115  const DtComplex& second,
116  const DtComplex& third,
117  const DtComplex& fourth) const;
118 
119  private:
120  double myRealPart;
121  double myImagPart;
122 };
123 
124 #endif

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)