Vector3.hpp
1 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
5 //
6 // This software is provided 'as-is', without any express or implied warranty.
7 // In no event will the authors be held liable for any damages arising from the use of this software.
8 //
9 // Permission is granted to anyone to use this software for any purpose,
10 // including commercial applications, and to alter it and redistribute it freely,
11 // subject to the following restrictions:
12 //
13 // 1. The origin of this software must not be misrepresented;
14 // you must not claim that you wrote the original software.
15 // If you use this software in a product, an acknowledgment
16 // in the product documentation would be appreciated but is not required.
17 //
18 // 2. Altered source versions must be plainly marked as such,
19 // and must not be misrepresented as being the original software.
20 //
21 // 3. This notice may not be removed or altered from any source distribution.
22 //
24 
25 #ifndef CPP3DS_VECTOR3_HPP
26 #define CPP3DS_VECTOR3_HPP
27 
28 
29 namespace cpp3ds
30 {
36 template <typename T>
37 class Vector3
38 {
39 public :
40 
47  Vector3();
48 
57  Vector3(T X, T Y, T Z);
58 
70  template <typename U>
71  explicit Vector3(const Vector3<U>& vector);
72 
74  // Member data
76  T x;
77  T y;
78  T z;
79 };
80 
90 template <typename T>
91 Vector3<T> operator -(const Vector3<T>& left);
92 
106 template <typename T>
107 Vector3<T>& operator +=(Vector3<T>& left, const Vector3<T>& right);
108 
122 template <typename T>
123 Vector3<T>& operator -=(Vector3<T>& left, const Vector3<T>& right);
124 
135 template <typename T>
136 Vector3<T> operator +(const Vector3<T>& left, const Vector3<T>& right);
137 
148 template <typename T>
149 Vector3<T> operator -(const Vector3<T>& left, const Vector3<T>& right);
150 
161 template <typename T>
162 Vector3<T> operator *(const Vector3<T>& left, T right);
163 
174 template <typename T>
175 Vector3<T> operator *(T left, const Vector3<T>& right);
176 
190 template <typename T>
191 Vector3<T>& operator *=(Vector3<T>& left, T right);
192 
203 template <typename T>
204 Vector3<T> operator /(const Vector3<T>& left, T right);
205 
219 template <typename T>
220 Vector3<T>& operator /=(Vector3<T>& left, T right);
221 
234 template <typename T>
235 bool operator ==(const Vector3<T>& left, const Vector3<T>& right);
236 
249 template <typename T>
250 bool operator !=(const Vector3<T>& left, const Vector3<T>& right);
251 
252 #include <cpp3ds/System/Vector3.inl>
253 
254 // Define the most common types
255 typedef Vector3<int> Vector3i;
256 typedef Vector3<float> Vector3f;
257 
258 } // namespace cpp3ds
259 
260 
261 #endif
262 
263 
T z
Z coordinate of the vector.
Definition: Vector3.hpp:78
Vector3()
Default constructor.
T x
X coordinate of the vector.
Definition: Vector3.hpp:76
T y
Y coordinate of the vector.
Definition: Vector3.hpp:77
Utility template class for manipulating 3-dimensional vectors.
Definition: Vector3.hpp:37