FOX/ObjCryst++  1.10.X (development)
mpVector.h
1 /* This program is free software; you can redistribute it and/or modify
2  it under the terms of the GNU General Public License as published by
3  the Free Software Foundation; either version 2 of the License, or
4  (at your option) any later version.
5 
6  This program is distributed in the hope that it will be useful,
7  but WITHOUT ANY WARRANTY; without even the implied warranty of
8  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  GNU General Public License for more details.
10 
11  You should have received a copy of the GNU General Public License
12  along with this program; if not, write to the Free Software
13  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14 */
16 //
17 // FileName: mpVector.h
18 // Author : Michael Y. Polyakov
19 // email : myp@andrew.cmu.edu or mikepolyakov@hotmail.com
20 // Website : www.angelfire.com/linux/myp
21 // Date : 7/16/2002
22 //
23 // Provides basic vector handling.
25 
26 #ifndef MPVECTOR_H
27 #define MPVECTOR_H
28 
29 #include <math.h>
30 #include <stdio.h>
31 #include <wx/string.h>
32 
33 class mp4Vector;
34 
35 class mpVector
36 {
37 friend class mp4Vector;
38 public:
39  float x, y, z;
40 
41  mpVector();
42  mpVector(float xx, float yy, float zz);
43  mpVector(const mpVector& other);
44 
45  mpVector& Normalize();
46  float Magnitude();
47  mpVector Cross(const mpVector& other);
48  mpVector operator - (mpVector v);
49  mpVector operator + (mpVector v);
50  float operator * (mpVector v);
51  mpVector operator - (float c);
52  mpVector operator + (float c);
53  mpVector operator / (float c);
54  mpVector operator * (float c);
55  void operator = (const mpVector& other);
56  operator mp4Vector() const;
57 
58  operator char*() const;
59 
60 };
61 
62 class mp4Vector
63 {
64 public:
65  float x, y, z, val;
66 
67  mp4Vector();
68  mp4Vector(float aa, float bb, float cc, float dd);
69  mp4Vector(const mp4Vector& other);
70  mp4Vector(const mpVector& v, const float value);
71 
72  void operator = (const mp4Vector& v);
73  void operator = (const mpVector& v);
74 
75  bool operator == (const mp4Vector& v) const;
76 
77  operator mpVector() const;
78 };
79 #endif