00001 00002 // 00003 // SFML - Simple and Fast Multimedia Library 00004 // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) 00005 // 00006 // This software is provided 'as-is', without any express or implied warranty. 00007 // In no event will the authors be held liable for any damages arising from the use of this software. 00008 // 00009 // Permission is granted to anyone to use this software for any purpose, 00010 // including commercial applications, and to alter it and redistribute it freely, 00011 // subject to the following restrictions: 00012 // 00013 // 1. The origin of this software must not be misrepresented; 00014 // you must not claim that you wrote the original software. 00015 // If you use this software in a product, an acknowledgment 00016 // in the product documentation would be appreciated but is not required. 00017 // 00018 // 2. Altered source versions must be plainly marked as such, 00019 // and must not be misrepresented as being the original software. 00020 // 00021 // 3. This notice may not be removed or altered from any source distribution. 00022 // 00024 00025 00027 template <typename T> 00028 inline Vector3<T>::Vector3() : 00029 x(0), 00030 y(0), 00031 z(0) 00032 { 00033 00034 } 00035 00036 00038 template <typename T> 00039 inline Vector3<T>::Vector3(T X, T Y, T Z) : 00040 x(X), 00041 y(Y), 00042 z(Z) 00043 { 00044 00045 } 00046 00047 00049 template <typename T> 00050 template <typename U> 00051 inline Vector3<T>::Vector3(const Vector3<U>& vector) : 00052 x(static_cast<T>(vector.x)), 00053 y(static_cast<T>(vector.y)), 00054 z(static_cast<T>(vector.z)) 00055 { 00056 } 00057 00058 00060 template <typename T> 00061 inline Vector3<T> operator -(const Vector3<T>& left) 00062 { 00063 return Vector3<T>(-left.x, -left.y, -left.z); 00064 } 00065 00066 00068 template <typename T> 00069 inline Vector3<T>& operator +=(Vector3<T>& left, const Vector3<T>& right) 00070 { 00071 left.x += right.x; 00072 left.y += right.y; 00073 left.z += right.z; 00074 00075 return left; 00076 } 00077 00078 00080 template <typename T> 00081 inline Vector3<T>& operator -=(Vector3<T>& left, const Vector3<T>& right) 00082 { 00083 left.x -= right.x; 00084 left.y -= right.y; 00085 left.z -= right.z; 00086 00087 return left; 00088 } 00089 00090 00092 template <typename T> 00093 inline Vector3<T> operator +(const Vector3<T>& left, const Vector3<T>& right) 00094 { 00095 return Vector3<T>(left.x + right.x, left.y + right.y, left.z + right.z); 00096 } 00097 00098 00100 template <typename T> 00101 inline Vector3<T> operator -(const Vector3<T>& left, const Vector3<T>& right) 00102 { 00103 return Vector3<T>(left.x - right.x, left.y - right.y, left.z - right.z); 00104 } 00105 00106 00108 template <typename T> 00109 inline Vector3<T> operator *(const Vector3<T>& left, T right) 00110 { 00111 return Vector3<T>(left.x * right, left.y * right, left.z * right); 00112 } 00113 00114 00116 template <typename T> 00117 inline Vector3<T> operator *(T left, const Vector3<T>& right) 00118 { 00119 return Vector3<T>(right.x * left, right.y * left, right.z * left); 00120 } 00121 00122 00124 template <typename T> 00125 inline Vector3<T>& operator *=(Vector3<T>& left, T right) 00126 { 00127 left.x *= right; 00128 left.y *= right; 00129 left.z *= right; 00130 00131 return left; 00132 } 00133 00134 00136 template <typename T> 00137 inline Vector3<T> operator /(const Vector3<T>& left, T right) 00138 { 00139 return Vector3<T>(left.x / right, left.y / right, left.z / right); 00140 } 00141 00142 00144 template <typename T> 00145 inline Vector3<T>& operator /=(Vector3<T>& left, T right) 00146 { 00147 left.x /= right; 00148 left.y /= right; 00149 left.z /= right; 00150 00151 return left; 00152 } 00153 00154 00156 template <typename T> 00157 inline bool operator ==(const Vector3<T>& left, const Vector3<T>& right) 00158 { 00159 return (left.x == right.x) && (left.y == right.y) && (left.z == right.z); 00160 } 00161 00162 00164 template <typename T> 00165 inline bool operator !=(const Vector3<T>& left, const Vector3<T>& right) 00166 { 00167 return (left.x != right.x) || (left.y != right.y) || (left.z != right.z); 00168 }
:: Copyright © 2007-2008 Laurent Gomila, all rights reserved :: Documentation generated by doxygen 1.5.2 ::