29 #ifndef _CEGUIVector_h_
30 #define _CEGUIVector_h_
32 #include "CEGUI/UDim.h"
54 public AllocatedObject<Vector2<T> >
62 inline Vector2(
const T x,
const T y):
67 inline Vector2(
const Vector2& v):
72 inline Vector2& operator*=(
const Vector2& vec)
80 inline Vector2& operator/=(
const Vector2& vec)
88 inline Vector2& operator+=(
const Vector2& vec)
96 inline Vector2& operator-=(
const Vector2& vec)
104 inline Vector2 operator+(
const Vector2& vec)
const
106 return Vector2(d_x + vec.d_x, d_y + vec.d_y);
109 inline Vector2 operator-(
const Vector2& vec)
const
111 return Vector2(d_x - vec.d_x, d_y - vec.d_y);
114 inline Vector2 operator*(
const Vector2& vec)
const
116 return Vector2(d_x * vec.d_x, d_y * vec.d_y);
119 inline Vector2 operator/(
const Vector2& vec)
const
121 return Vector2(d_x / vec.d_x, d_y / vec.d_y);
124 inline Vector2 operator*(
const T c)
const
126 return Vector2(d_x * c, d_y * c);
129 inline Vector2& operator*=(
const T c)
137 inline Vector2 operator/(
const T c)
const
139 return Vector2(d_x / c, d_y / c);
142 inline bool operator==(
const Vector2& vec)
const
144 return ((d_x == vec.d_x) && (d_y == vec.d_y));
147 inline bool operator!=(
const Vector2& vec)
const
149 return !(operator==(vec));
157 s <<
"CEGUI::Vector2<" <<
typeid(T).name() <<
">(" << v.d_x <<
", " << v.d_y <<
")";
164 return Vector2(TypeSensitiveZero<T>(), TypeSensitiveZero<T>());
170 return Vector2(TypeSensitiveOne<T>(), TypeSensitiveOne<T>());
176 return Vector2(TypeSensitiveOne<T>(), TypeSensitiveZero<T>());
182 return Vector2(TypeSensitiveZero<T>(), TypeSensitiveOne<T>());
190 typedef Vector2<float> Vector2f;
193 inline Vector2<UDim> operator * (
const Vector2<UDim>& v,
const float c)
195 return Vector2<UDim>(v.d_x * c, v.d_y * c);
198 typedef Vector2<UDim> UVector2;
214 public AllocatedObject<Vector3<T> >
217 typedef T value_type;
222 inline Vector3(
const T x,
const T y,
const T z):
228 inline explicit Vector3(
const Vector2<T>& v,
const T z):
234 inline Vector3(
const Vector3& v):
240 inline bool operator==(
const Vector3& vec)
const
242 return ((d_x == vec.d_x) && (d_y == vec.d_y) && (d_z == vec.d_z));
245 inline bool operator!=(
const Vector3& vec)
const
247 return !(operator==(vec));
250 inline Vector3 operator*(
const T c)
const
252 return Vector3(d_x * c, d_y * c, d_z * c);
255 inline Vector3 operator+(
const Vector3& v)
const
257 return Vector3(d_x + v.d_x, d_y + v.d_y, d_z + v.d_z);
260 inline Vector3 operator-(
const Vector3& v)
const
262 return Vector3(d_x - v.d_x, d_y - v.d_y, d_z - v.d_z);
270 s <<
"CEGUI::Vector3<" <<
typeid(T).name() <<
">(" << v.d_x <<
", " << v.d_y <<
", " << v.d_z <<
")";
277 return Vector3(TypeSensitiveZero<T>(), TypeSensitiveZero<T>(), TypeSensitiveZero<T>());
283 return Vector3(TypeSensitiveOne<T>(), TypeSensitiveOne<T>(), TypeSensitiveOne<T>());
289 return Vector3(TypeSensitiveOne<T>(), TypeSensitiveZero<T>(), TypeSensitiveZero<T>());
295 return Vector3(TypeSensitiveZero<T>(), TypeSensitiveOne<T>(), TypeSensitiveZero<T>());
301 return Vector3(TypeSensitiveZero<T>(), TypeSensitiveZero<T>(), TypeSensitiveOne<T>());
310 typedef Vector3<float> Vector3f;
314 #endif // end of guard _CEGUIVector_h_