SFML logo
  • Main Page
  • Namespaces
  • Classes
  • Files
  • File List

Vector3.inl

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 inline Vector3<T> operator -(const Vector3<T>& left)
00051 {
00052     return Vector3<T>(-left.x, -left.y, -left.z);
00053 }
00054 
00055 
00057 template <typename T>
00058 inline Vector3<T>& operator +=(Vector3<T>& left, const Vector3<T>& right)
00059 {
00060     left.x += right.x;
00061     left.y += right.y;
00062     left.z += right.z;
00063 
00064     return left;
00065 }
00066 
00067 
00069 template <typename T>
00070 inline Vector3<T>& operator -=(Vector3<T>& left, const Vector3<T>& right)
00071 {
00072     left.x -= right.x;
00073     left.y -= right.y;
00074     left.z -= right.z;
00075 
00076     return left;
00077 }
00078 
00079 
00081 template <typename T>
00082 inline Vector3<T> operator +(const Vector3<T>& left, const Vector3<T>& right)
00083 {
00084     return Vector3<T>(left.x + right.x, left.y + right.y, left.z + right.z);
00085 }
00086 
00087 
00089 template <typename T>
00090 inline Vector3<T> operator -(const Vector3<T>& left, const Vector3<T>& right)
00091 {
00092     return Vector3<T>(left.x - right.x, left.y - right.y, left.z - right.z);
00093 }
00094 
00095 
00097 template <typename T>
00098 inline Vector3<T> operator *(const Vector3<T>& left, T right)
00099 {
00100     return Vector3<T>(left.x * right, left.y * right, left.z * right);
00101 }
00102 
00103 
00105 template <typename T>
00106 inline Vector3<T> operator *(T left, const Vector3<T>& right)
00107 {
00108     return Vector3<T>(right.x * left, right.y * left, right.z * left);
00109 }
00110 
00111 
00113 template <typename T>
00114 inline Vector3<T>& operator *=(Vector3<T>& left, T right)
00115 {
00116     left.x *= right;
00117     left.y *= right;
00118     left.z *= right;
00119 
00120     return left;
00121 }
00122 
00123 
00125 template <typename T>
00126 inline Vector3<T> operator /(const Vector3<T>& left, T right)
00127 {
00128     return Vector3<T>(left.x / right, left.y / right, left.z / right);
00129 }
00130 
00131 
00133 template <typename T>
00134 inline Vector3<T>& operator /=(Vector3<T>& left, T right)
00135 {
00136     left.x /= right;
00137     left.y /= right;
00138     left.z /= right;
00139 
00140     return left;
00141 }
00142 
00143 
00145 template <typename T>
00146 inline bool operator ==(const Vector3<T>& left, const Vector3<T>& right)
00147 {
00148     return (left.x == right.x) && (left.y == right.y) && (left.z == right.z);
00149 }
00150 
00151 
00153 template <typename T>
00154 inline bool operator !=(const Vector3<T>& left, const Vector3<T>& right)
00155 {
00156     return (left.x != right.x) || (left.y != right.y) || (left.z != right.z);
00157 }

 ::  Copyright © 2007-2008 Laurent Gomila, all rights reserved  ::  Documentation generated by doxygen 1.5.2  ::