ScummVM API documentation
vector.h
1 
2 /* ScummVM - Graphic Adventure Engine
3  *
4  * ScummVM is the legal property of its developers, whose names
5  * are too numerous to list here. Please refer to the COPYRIGHT
6  * file distributed with this source distribution.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef BAGEL_BOFLIB_VECTOR_H
24 #define BAGEL_BOFLIB_VECTOR_H
25 
26 #include "bagel/boflib/stdinc.h"
27 #include "bagel/boflib/object.h"
28 
29 namespace Bagel {
30 namespace SpaceBar {
31 
32 #define PI (double)3.141592653
33 #define RADCNVT ((double)180 / PI) // PI is 180 degrees
34 
35 #define Deg2Rad(d) ((d) / RADCNVT) // Converts degrees to radians
36 #define Rad2Deg(r) ((r) * RADCNVT) // Converts radians to degrees
37 
38 class CVector : public CBofObject, public Vector {
39 public:
43  CVector();
44 
48  CVector(const Vector &stVector);
49 
53  CVector(double xx, double yy, double zz = 0);
54 
60  double dotProduct(const Vector &vector);
61 
66  void rotate(double fAngle);
67 
73  double angleBetween(const Vector &vector);
74 
80  double realAngle(const Vector &vector);
81 
86  double length();
87 
88  // Generic operations
89  CVector operator+(Vector);
90  CVector operator+(double);
91  CVector operator-(Vector);
92  CVector operator-(double);
93  CVector operator*(double);
94  CVector operator/(double);
95  void operator+=(Vector);
96  void operator-=(Vector);
97  void operator*=(double);
98  void operator/=(double);
99  bool operator==(Vector);
100 };
101 
102 } // namespace SpaceBar
103 } // namespace Bagel
104 
105 #endif
Definition: stdinc.h:52
Definition: object.h:28
double realAngle(const Vector &vector)
void rotate(double fAngle)
double angleBetween(const Vector &vector)
Definition: afxwin.h:27
double dotProduct(const Vector &vector)
Definition: vector.h:38