Vector3.hpp
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2009 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 SFML_VECTOR3_HPP
26#define SFML_VECTOR3_HPP
27
28
29namespace sf
30{
31////////////////////////////////////////////////////////////
32/// Vector3 is an utility class for manipulating 3 dimensional
33/// vectors. Template parameter defines the type of coordinates
34/// (integer, float, ...)
35////////////////////////////////////////////////////////////
36template <typename T>
38{
39public :
40
44 ////////////////////////////////////////////////////////////
46
51
55 Vector3(T X, T Y, T Z);
56
58 // Member data
60 T x;
61 T y;
62 T z;
63};
64
73template <typename T>
74Vector3<T> operator -(const Vector3<T>& V);
75
85template <typename T>
86Vector3<T>& operator +=(Vector3<T>& V1, const Vector3<T>& V2);
87
97template <typename T>
98Vector3<T>& operator -=(Vector3<T>& V1, const Vector3<T>& V2);
99
109template <typename T>
110Vector3<T> operator +(const Vector3<T>& V1, const Vector3<T>& V2);
111
121template <typename T>
122Vector3<T> operator -(const Vector3<T>& V1, const Vector3<T>& V2);
123
133template <typename T>
134Vector3<T> operator *(const Vector3<T>& V, T X);
135
145template <typename T>
146Vector3<T> operator *(T X, const Vector3<T>& V);
147
157template <typename T>
158Vector3<T>& operator *=(Vector3<T>& V, T X);
159
169template <typename T>
170Vector3<T> operator /(const Vector3<T>& V, T X);
171
181template <typename T>
182Vector3<T>& operator /=(Vector3<T>& V, T X);
183
193template <typename T>
194bool operator ==(const Vector3<T>& V1, const Vector3<T>& V2);
195
205template <typename T>
206bool operator !=(const Vector3<T>& V1, const Vector3<T>& V2);
207
208#include <SFML/System/Vector3.inl>
209
210// Define the most common types
211typedef Vector3<int> Vector3i;
212typedef Vector3<float> Vector3f;
213
214} // namespace sf
215
216
217#endif // SFML_VECTOR3_HPP
Vector3 is an utility class for manipulating 3 dimensional vectors.
Definition Vector3.hpp:38
Vector3()
Default constructor.
Definition Vector3.hpp:31
Vector3(T X, T Y, T Z)
Construct the vector from its coordinates.
Definition Vector3.hpp:44