30 #ifndef _CEGUIVector_h_
31 #define _CEGUIVector_h_
33 #include "CEGUI/UDim.h"
55 public AllocatedObject<Vector2<T> >
63 inline Vector2(
const T x,
const T y):
68 inline Vector2(
const Vector2& v):
73 inline Vector2& operator*=(
const Vector2& vec)
81 inline Vector2& operator/=(
const Vector2& vec)
89 inline Vector2& operator+=(
const Vector2& vec)
97 inline Vector2& operator-=(
const Vector2& vec)
105 inline Vector2 operator+(
const Vector2& vec)
const
107 return Vector2(d_x + vec.d_x, d_y + vec.d_y);
110 inline Vector2 operator-(
const Vector2& vec)
const
112 return Vector2(d_x - vec.d_x, d_y - vec.d_y);
115 inline Vector2 operator*(
const Vector2& vec)
const
117 return Vector2(d_x * vec.d_x, d_y * vec.d_y);
120 inline Vector2 operator/(
const Vector2& vec)
const
122 return Vector2(d_x / vec.d_x, d_y / vec.d_y);
125 inline Vector2 operator*(
const T c)
const
127 return Vector2(d_x * c, d_y * c);
130 inline Vector2& operator*=(
const T c)
138 inline Vector2 operator/(
const T c)
const
140 return Vector2(d_x / c, d_y / c);
143 inline bool operator==(
const Vector2& vec)
const
145 return ((d_x == vec.d_x) && (d_y == vec.d_y));
148 inline bool operator!=(
const Vector2& vec)
const
150 return !(operator==(vec));
158 s <<
"CEGUI::Vector2<" <<
typeid(T).name() <<
">(" << v.d_x <<
", " << v.d_y <<
")";
165 return Vector2(TypeSensitiveZero<T>(), TypeSensitiveZero<T>());
171 return Vector2(TypeSensitiveOne<T>(), TypeSensitiveOne<T>());
177 return Vector2(TypeSensitiveOne<T>(), TypeSensitiveZero<T>());
183 return Vector2(TypeSensitiveZero<T>(), TypeSensitiveOne<T>());
191 typedef Vector2<float> Vector2f;
194 inline Vector2<UDim> operator * (
const Vector2<UDim>& v,
const float c)
196 return Vector2<UDim>(v.d_x * c, v.d_y * c);
199 typedef Vector2<UDim> UVector2;
215 public AllocatedObject<Vector3<T> >
218 typedef T value_type;
223 inline Vector3(
const T x,
const T y,
const T z):
229 inline explicit Vector3(
const Vector2<T>& v,
const T z):
235 inline Vector3(
const Vector3& v):
241 inline bool operator==(
const Vector3& vec)
const
243 return ((d_x == vec.d_x) && (d_y == vec.d_y) && (d_z == vec.d_z));
246 inline bool operator!=(
const Vector3& vec)
const
248 return !(operator==(vec));
251 inline Vector3 operator*(
const T c)
const
253 return Vector3(d_x * c, d_y * c, d_z * c);
256 inline Vector3 operator+(
const Vector3& v)
const
258 return Vector3(d_x + v.d_x, d_y + v.d_y, d_z + v.d_z);
261 inline Vector3 operator-(
const Vector3& v)
const
263 return Vector3(d_x - v.d_x, d_y - v.d_y, d_z - v.d_z);
271 s <<
"CEGUI::Vector3<" <<
typeid(T).name() <<
">(" << v.d_x <<
", " << v.d_y <<
", " << v.d_z <<
")";
278 return Vector3(TypeSensitiveZero<T>(), TypeSensitiveZero<T>(), TypeSensitiveZero<T>());
284 return Vector3(TypeSensitiveOne<T>(), TypeSensitiveOne<T>(), TypeSensitiveOne<T>());
290 return Vector3(TypeSensitiveOne<T>(), TypeSensitiveZero<T>(), TypeSensitiveZero<T>());
296 return Vector3(TypeSensitiveZero<T>(), TypeSensitiveOne<T>(), TypeSensitiveZero<T>());
302 return Vector3(TypeSensitiveZero<T>(), TypeSensitiveZero<T>(), TypeSensitiveOne<T>());
311 typedef Vector3<float> Vector3f;
315 #endif // end of guard _CEGUIVector_h_