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 
31 #define PI (double)3.141592653
32 #define RADCNVT ((double)180 / PI) // PI is 180 degrees
33 
34 #define Deg2Rad(d) ((d) / RADCNVT) // Converts degrees to radians
35 #define Rad2Deg(r) ((r) * RADCNVT) // Converts radians to degrees
36 
37 class CVector : public CBofObject, public Vector {
38 public:
42  CVector();
43 
47  CVector(const Vector &stVector);
48 
52  CVector(double xx, double yy, double zz = 0);
53 
59  double dotProduct(const Vector &vector);
60 
65  void rotate(double fAngle);
66 
72  double angleBetween(const Vector &vector);
73 
79  double realAngle(const Vector &vector);
80 
85  double length();
86 
87  // Generic operations
88  CVector operator+(Vector);
89  CVector operator+(double);
90  CVector operator-(Vector);
91  CVector operator-(double);
92  CVector operator*(double);
93  CVector operator/(double);
94  void operator+=(Vector);
95  void operator-=(Vector);
96  void operator*=(double);
97  void operator/=(double);
98  bool operator==(Vector);
99 };
100 
101 } // namespace Bagel
102 
103 #endif
Definition: stdinc.h:50
Definition: object.h:28
double length()
double dotProduct(const Vector &vector)
double realAngle(const Vector &vector)
Definition: bagel.h:31
double angleBetween(const Vector &vector)
void rotate(double fAngle)
Definition: vector.h:37