- Partly implemented client side prediction (still unstable).
[peakengine.git] / engine / include / core / Vector3D.h
blob32405d0b96075dc8a18fd65e8e934a6137457217
1 /*
2 Copyright (C) 2008 Mathias Gottschlag
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in the
6 Software without restriction, including without limitation the rights to use,
7 copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8 Software, and to permit persons to whom the Software is furnished to do so,
9 subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 #ifndef _VECTOR3D_H_
23 #define _VECTOR3D_H_
25 //tolua_begin
26 namespace peak
28 /**
29 * \brief 3-dimensional vector class
31 class Vector3D
33 public:
34 Vector3D();
35 Vector3D(float x, float y, float z);
36 ~Vector3D();
38 /**
39 * \brief Rotates the vector around the y-axis.
40 * \param radians Rotation angle
42 void rotateXZ(float radians);
43 /**
44 * \brief Rotates the vector around the x-axis.
45 * \param radians Rotation angle
47 void rotateYZ(float radians);
48 /**
49 * \brief Rotates the vector around the z-axis.
50 * \param radians Rotation angle
52 void rotateXY(float radians);
54 /**
55 * \brief Rotates the vector.
56 * \param rotation Rotation in euler angles
58 void rotate(Vector3D rotation);
60 /**
61 * \brief Returns the rotation of the vector.
63 * If you would rotate the vector 0/0/1 by this rotation, it would have
64 * the same direction as this vector.
66 Vector3D getRotation(void);
68 /**
69 * \brief Returns the squared length of the vector
71 float getLengthSq(void);
73 float x;
74 float y;
75 float z;
77 //tolua_end
78 Vector3D &operator*=(float scale);
79 Vector3D operator+(const Vector3D &v);
80 Vector3D operator-(const Vector3D &v);
81 Vector3D operator*(const float scale);
82 //tolua_begin
85 //tolua_end
87 #endif