[692] | 1 | <html> |
---|
| 2 | <head> |
---|
| 3 | <title>OgreVector4.h Source File - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
| 4 | <link type="text/css" rel="stylesheet" href="style.css"> |
---|
| 5 | </head> |
---|
| 6 | |
---|
| 7 | <body> |
---|
| 8 | <!-- Generated by Doxygen 1.3.6 --> |
---|
| 9 | <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div> |
---|
| 10 | <h1>OgreVector4.h</h1><a href="OgreVector4_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span> |
---|
| 11 | 00002 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
| 12 | 00003 <span class="comment">This source file is part of OGRE</span> |
---|
| 13 | 00004 <span class="comment"> (Object-oriented Graphics Rendering Engine)</span> |
---|
| 14 | 00005 <span class="comment">For the latest info, see http://www.ogre3d.org/</span> |
---|
| 15 | 00006 <span class="comment"></span> |
---|
| 16 | 00007 <span class="comment">Copyright (c) 2000-2005 The OGRE Team</span> |
---|
| 17 | 00008 <span class="comment">Also see acknowledgements in Readme.html</span> |
---|
| 18 | 00009 <span class="comment"></span> |
---|
| 19 | 00010 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span> |
---|
| 20 | 00011 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span> |
---|
| 21 | 00012 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span> |
---|
| 22 | 00013 <span class="comment">version.</span> |
---|
| 23 | 00014 <span class="comment"></span> |
---|
| 24 | 00015 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span> |
---|
| 25 | 00016 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span> |
---|
| 26 | 00017 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span> |
---|
| 27 | 00018 <span class="comment"></span> |
---|
| 28 | 00019 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span> |
---|
| 29 | 00020 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span> |
---|
| 30 | 00021 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span> |
---|
| 31 | 00022 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span> |
---|
| 32 | 00023 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
| 33 | 00024 <span class="comment">*/</span> |
---|
| 34 | 00025 <span class="preprocessor">#ifndef __Vector4_H__</span> |
---|
| 35 | 00026 <span class="preprocessor"></span><span class="preprocessor">#define __Vector4_H__</span> |
---|
| 36 | 00027 <span class="preprocessor"></span> |
---|
| 37 | 00028 <span class="preprocessor">#include "<a class="code" href="OgrePrerequisites_8h.html">OgrePrerequisites.h</a>"</span> |
---|
| 38 | 00029 <span class="preprocessor">#include "<a class="code" href="OgreVector3_8h.html">OgreVector3.h</a>"</span> |
---|
| 39 | 00030 |
---|
| 40 | 00031 <span class="keyword">namespace </span>Ogre |
---|
| 41 | 00032 { |
---|
| 42 | 00033 |
---|
| 43 | <a name="l00036"></a><a class="code" href="classOgre_1_1Vector4.html">00036</a> <span class="keyword">class </span><a class="code" href="OgrePlatform_8h.html#a16">_OgreExport</a> Vector4 |
---|
| 44 | 00037 { |
---|
| 45 | 00038 <span class="keyword">public</span>: |
---|
| 46 | 00039 <span class="keyword">union </span>{ |
---|
| 47 | 00040 <span class="keyword">struct </span>{ |
---|
| 48 | <a name="l00041"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">00041</a> <a class="code" href="namespaceOgre.html#a465">Real</a> x, y, z, w; |
---|
| 49 | 00042 }; |
---|
| 50 | <a name="l00043"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o4">00043</a> <a class="code" href="namespaceOgre.html#a465">Real</a> val[4]; |
---|
| 51 | 00044 }; |
---|
| 52 | 00045 |
---|
| 53 | 00046 <span class="keyword">public</span>: |
---|
| 54 | <a name="l00047"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a0">00047</a> <span class="keyword">inline</span> Vector4() |
---|
| 55 | 00048 { |
---|
| 56 | 00049 } |
---|
| 57 | 00050 |
---|
| 58 | <a name="l00051"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a1">00051</a> <span class="keyword">inline</span> Vector4( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> fX, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> fY, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> fZ, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> fW ) |
---|
| 59 | 00052 : x( fX ), y( fY ), z( fZ ), w( fW) |
---|
| 60 | 00053 { |
---|
| 61 | 00054 } |
---|
| 62 | 00055 |
---|
| 63 | <a name="l00056"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a2">00056</a> <span class="keyword">inline</span> <span class="keyword">explicit</span> Vector4( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> afCoordinate[4] ) |
---|
| 64 | 00057 : x( afCoordinate[0] ), |
---|
| 65 | 00058 y( afCoordinate[1] ), |
---|
| 66 | 00059 z( afCoordinate[2] ), |
---|
| 67 | 00060 w( afCoordinate[3] ) |
---|
| 68 | 00061 { |
---|
| 69 | 00062 } |
---|
| 70 | 00063 |
---|
| 71 | <a name="l00064"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a3">00064</a> <span class="keyword">inline</span> <span class="keyword">explicit</span> Vector4( <span class="keyword">const</span> <span class="keywordtype">int</span> afCoordinate[4] ) |
---|
| 72 | 00065 { |
---|
| 73 | 00066 x = (<a class="code" href="namespaceOgre.html#a465">Real</a>)afCoordinate[0]; |
---|
| 74 | 00067 y = (<a class="code" href="namespaceOgre.html#a465">Real</a>)afCoordinate[1]; |
---|
| 75 | 00068 z = (<a class="code" href="namespaceOgre.html#a465">Real</a>)afCoordinate[2]; |
---|
| 76 | 00069 w = (<a class="code" href="namespaceOgre.html#a465">Real</a>)afCoordinate[3]; |
---|
| 77 | 00070 } |
---|
| 78 | 00071 |
---|
| 79 | <a name="l00072"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a4">00072</a> <span class="keyword">inline</span> <span class="keyword">explicit</span> Vector4( <a class="code" href="namespaceOgre.html#a465">Real</a>* <span class="keyword">const</span> r ) |
---|
| 80 | 00073 : x( r[0] ), y( r[1] ), z( r[2] ), w( r[3] ) |
---|
| 81 | 00074 { |
---|
| 82 | 00075 } |
---|
| 83 | 00076 |
---|
| 84 | <a name="l00077"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a5">00077</a> <span class="keyword">inline</span> <span class="keyword">explicit</span> Vector4( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> scaler ) |
---|
| 85 | 00078 : x( scaler ) |
---|
| 86 | 00079 , y( scaler ) |
---|
| 87 | 00080 , z( scaler ) |
---|
| 88 | 00081 , w( scaler ) |
---|
| 89 | 00082 { |
---|
| 90 | 00083 } |
---|
| 91 | 00084 |
---|
| 92 | <a name="l00085"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a6">00085</a> <span class="keyword">inline</span> Vector4( <span class="keyword">const</span> Vector4& rkVector ) |
---|
| 93 | 00086 : x( rkVector.x ), y( rkVector.y ), z( rkVector.z ), w (rkVector.w) |
---|
| 94 | 00087 { |
---|
| 95 | 00088 } |
---|
| 96 | 00089 |
---|
| 97 | <a name="l00090"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a7">00090</a> <span class="keyword">inline</span> <a class="code" href="namespaceOgre.html#a465">Real</a> operator [] ( <span class="keyword">const</span> size_t i )<span class="keyword"> const</span> |
---|
| 98 | 00091 <span class="keyword"> </span>{ |
---|
| 99 | 00092 assert( i < 4 ); |
---|
| 100 | 00093 |
---|
| 101 | 00094 <span class="keywordflow">return</span> *(&x+i); |
---|
| 102 | 00095 } |
---|
| 103 | 00096 |
---|
| 104 | <a name="l00097"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a8">00097</a> <span class="keyword">inline</span> <a class="code" href="namespaceOgre.html#a465">Real</a>& operator [] ( <span class="keyword">const</span> size_t i ) |
---|
| 105 | 00098 { |
---|
| 106 | 00099 assert( i < 4 ); |
---|
| 107 | 00100 |
---|
| 108 | 00101 <span class="keywordflow">return</span> *(&x+i); |
---|
| 109 | 00102 } |
---|
| 110 | 00103 |
---|
| 111 | <a name="l00108"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a9">00108</a> <span class="keyword">inline</span> Vector4& operator = ( <span class="keyword">const</span> Vector4& rkVector ) |
---|
| 112 | 00109 { |
---|
| 113 | 00110 x = rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a>; |
---|
| 114 | 00111 y = rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a>; |
---|
| 115 | 00112 z = rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a>; |
---|
| 116 | 00113 w = rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a>; |
---|
| 117 | 00114 |
---|
| 118 | 00115 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
| 119 | 00116 } |
---|
| 120 | 00117 |
---|
| 121 | <a name="l00118"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a10">00118</a> <span class="keyword">inline</span> Vector4& operator = ( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> fScalar) |
---|
| 122 | 00119 { |
---|
| 123 | 00120 x = fScalar; |
---|
| 124 | 00121 y = fScalar; |
---|
| 125 | 00122 z = fScalar; |
---|
| 126 | 00123 w = fScalar; |
---|
| 127 | 00124 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
| 128 | 00125 } |
---|
| 129 | 00126 |
---|
| 130 | <a name="l00127"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a11">00127</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespaceOgre.html#a623">operator == </a>( <span class="keyword">const</span> Vector4& rkVector )<span class="keyword"> const</span> |
---|
| 131 | 00128 <span class="keyword"> </span>{ |
---|
| 132 | 00129 <span class="keywordflow">return</span> ( x == rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> && |
---|
| 133 | 00130 y == rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> && |
---|
| 134 | 00131 z == rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> && |
---|
| 135 | 00132 w == rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> ); |
---|
| 136 | 00133 } |
---|
| 137 | 00134 |
---|
| 138 | <a name="l00135"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a12">00135</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespaceOgre.html#a624">operator != </a>( <span class="keyword">const</span> Vector4& rkVector )<span class="keyword"> const</span> |
---|
| 139 | 00136 <span class="keyword"> </span>{ |
---|
| 140 | 00137 <span class="keywordflow">return</span> ( x != rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> || |
---|
| 141 | 00138 y != rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> || |
---|
| 142 | 00139 z != rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> || |
---|
| 143 | 00140 w != rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> ); |
---|
| 144 | 00141 } |
---|
| 145 | 00142 |
---|
| 146 | <a name="l00143"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a13">00143</a> <span class="keyword">inline</span> Vector4& operator = (<span class="keyword">const</span> <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& rhs) |
---|
| 147 | 00144 { |
---|
| 148 | 00145 x = rhs.<a class="code" href="classOgre_1_1Vector3.html#Ogre_1_1Vector3o0">x</a>; |
---|
| 149 | 00146 y = rhs.<a class="code" href="classOgre_1_1Vector3.html#Ogre_1_1Vector3o1">y</a>; |
---|
| 150 | 00147 z = rhs.<a class="code" href="classOgre_1_1Vector3.html#Ogre_1_1Vector3o2">z</a>; |
---|
| 151 | 00148 w = 1.0f; |
---|
| 152 | 00149 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
| 153 | 00150 } |
---|
| 154 | 00151 |
---|
| 155 | 00152 <span class="comment">// arithmetic operations</span> |
---|
| 156 | <a name="l00153"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a14">00153</a> <span class="keyword">inline</span> Vector4 operator + ( <span class="keyword">const</span> Vector4& rkVector )<span class="keyword"> const</span> |
---|
| 157 | 00154 <span class="keyword"> </span>{ |
---|
| 158 | 00155 Vector4 kSum; |
---|
| 159 | 00156 |
---|
| 160 | 00157 kSum.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> = x + rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a>; |
---|
| 161 | 00158 kSum.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> = y + rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a>; |
---|
| 162 | 00159 kSum.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> = z + rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a>; |
---|
| 163 | 00160 kSum.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> = w + rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a>; |
---|
| 164 | 00161 |
---|
| 165 | 00162 <span class="keywordflow">return</span> kSum; |
---|
| 166 | 00163 } |
---|
| 167 | 00164 |
---|
| 168 | <a name="l00165"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a15">00165</a> <span class="keyword">inline</span> Vector4 operator - ( <span class="keyword">const</span> Vector4& rkVector )<span class="keyword"> const</span> |
---|
| 169 | 00166 <span class="keyword"> </span>{ |
---|
| 170 | 00167 Vector4 kDiff; |
---|
| 171 | 00168 |
---|
| 172 | 00169 kDiff.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> = x - rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a>; |
---|
| 173 | 00170 kDiff.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> = y - rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a>; |
---|
| 174 | 00171 kDiff.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> = z - rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a>; |
---|
| 175 | 00172 kDiff.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> = w - rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a>; |
---|
| 176 | 00173 |
---|
| 177 | 00174 <span class="keywordflow">return</span> kDiff; |
---|
| 178 | 00175 } |
---|
| 179 | 00176 |
---|
| 180 | <a name="l00177"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a16">00177</a> <span class="keyword">inline</span> Vector4 <a class="code" href="namespaceOgre.html#a617">operator * </a>( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> fScalar )<span class="keyword"> const</span> |
---|
| 181 | 00178 <span class="keyword"> </span>{ |
---|
| 182 | 00179 Vector4 kProd; |
---|
| 183 | 00180 |
---|
| 184 | 00181 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> = fScalar*x; |
---|
| 185 | 00182 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> = fScalar*y; |
---|
| 186 | 00183 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> = fScalar*z; |
---|
| 187 | 00184 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> = fScalar*w; |
---|
| 188 | 00185 |
---|
| 189 | 00186 <span class="keywordflow">return</span> kProd; |
---|
| 190 | 00187 } |
---|
| 191 | 00188 |
---|
| 192 | <a name="l00189"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a17">00189</a> <span class="keyword">inline</span> Vector4 <a class="code" href="namespaceOgre.html#a617">operator * </a>( <span class="keyword">const</span> Vector4& rhs)<span class="keyword"> const</span> |
---|
| 193 | 00190 <span class="keyword"> </span>{ |
---|
| 194 | 00191 Vector4 kProd; |
---|
| 195 | 00192 |
---|
| 196 | 00193 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> = rhs.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> * x; |
---|
| 197 | 00194 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> = rhs.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> * y; |
---|
| 198 | 00195 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> = rhs.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> * z; |
---|
| 199 | 00196 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> = rhs.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> * w; |
---|
| 200 | 00197 |
---|
| 201 | 00198 <span class="keywordflow">return</span> kProd; |
---|
| 202 | 00199 } |
---|
| 203 | 00200 |
---|
| 204 | <a name="l00201"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a18">00201</a> <span class="keyword">inline</span> Vector4 <a class="code" href="namespaceOgre.html#a618">operator / </a>( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> fScalar )<span class="keyword"> const</span> |
---|
| 205 | 00202 <span class="keyword"> </span>{ |
---|
| 206 | 00203 assert( fScalar != 0.0 ); |
---|
| 207 | 00204 |
---|
| 208 | 00205 Vector4 kDiv; |
---|
| 209 | 00206 |
---|
| 210 | 00207 <a class="code" href="namespaceOgre.html#a465">Real</a> fInv = 1.0 / fScalar; |
---|
| 211 | 00208 kDiv.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> = x * fInv; |
---|
| 212 | 00209 kDiv.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> = y * fInv; |
---|
| 213 | 00210 kDiv.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> = z * fInv; |
---|
| 214 | 00211 kDiv.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> = w * fInv; |
---|
| 215 | 00212 |
---|
| 216 | 00213 <span class="keywordflow">return</span> kDiv; |
---|
| 217 | 00214 } |
---|
| 218 | 00215 |
---|
| 219 | <a name="l00216"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a19">00216</a> <span class="keyword">inline</span> Vector4 <a class="code" href="namespaceOgre.html#a618">operator / </a>( <span class="keyword">const</span> Vector4& rhs)<span class="keyword"> const</span> |
---|
| 220 | 00217 <span class="keyword"> </span>{ |
---|
| 221 | 00218 Vector4 kDiv; |
---|
| 222 | 00219 |
---|
| 223 | 00220 kDiv.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> = x / rhs.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a>; |
---|
| 224 | 00221 kDiv.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> = y / rhs.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a>; |
---|
| 225 | 00222 kDiv.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> = z / rhs.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a>; |
---|
| 226 | 00223 kDiv.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> = w / rhs.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a>; |
---|
| 227 | 00224 |
---|
| 228 | 00225 <span class="keywordflow">return</span> kDiv; |
---|
| 229 | 00226 } |
---|
| 230 | 00227 |
---|
| 231 | 00228 |
---|
| 232 | <a name="l00229"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a20">00229</a> <span class="keyword">inline</span> Vector4 operator - ()<span class="keyword"> const</span> |
---|
| 233 | 00230 <span class="keyword"> </span>{ |
---|
| 234 | 00231 Vector4 kNeg; |
---|
| 235 | 00232 |
---|
| 236 | 00233 kNeg.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> = -x; |
---|
| 237 | 00234 kNeg.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> = -y; |
---|
| 238 | 00235 kNeg.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> = -z; |
---|
| 239 | 00236 kNeg.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> = -w; |
---|
| 240 | 00237 |
---|
| 241 | 00238 <span class="keywordflow">return</span> kNeg; |
---|
| 242 | 00239 } |
---|
| 243 | 00240 |
---|
| 244 | <a name="l00241"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4n0">00241</a> <span class="keyword">inline</span> <span class="keyword">friend</span> Vector4 <a class="code" href="namespaceOgre.html#a617">operator * </a>( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> fScalar, <span class="keyword">const</span> Vector4& rkVector ) |
---|
| 245 | 00242 { |
---|
| 246 | 00243 Vector4 kProd; |
---|
| 247 | 00244 |
---|
| 248 | 00245 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> = fScalar * rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a>; |
---|
| 249 | 00246 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> = fScalar * rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a>; |
---|
| 250 | 00247 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> = fScalar * rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a>; |
---|
| 251 | 00248 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> = fScalar * rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a>; |
---|
| 252 | 00249 |
---|
| 253 | 00250 <span class="keywordflow">return</span> kProd; |
---|
| 254 | 00251 } |
---|
| 255 | 00252 |
---|
| 256 | <a name="l00253"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4n1">00253</a> <span class="keyword">inline</span> <span class="keyword">friend</span> Vector4 operator + (<span class="keyword">const</span> Vector4& lhs, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> rhs) |
---|
| 257 | 00254 { |
---|
| 258 | 00255 Vector4 ret; |
---|
| 259 | 00256 ret = rhs; |
---|
| 260 | 00257 <span class="keywordflow">return</span> ret += lhs; |
---|
| 261 | 00258 } |
---|
| 262 | 00259 |
---|
| 263 | <a name="l00260"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4n2">00260</a> <span class="keyword">inline</span> <span class="keyword">friend</span> Vector4 operator + (<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> lhs, <span class="keyword">const</span> Vector4& rhs) |
---|
| 264 | 00261 { |
---|
| 265 | 00262 Vector4 ret; |
---|
| 266 | 00263 ret = lhs; |
---|
| 267 | 00264 <span class="keywordflow">return</span> ret += rhs; |
---|
| 268 | 00265 } |
---|
| 269 | 00266 |
---|
| 270 | <a name="l00267"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4n3">00267</a> <span class="keyword">inline</span> <span class="keyword">friend</span> Vector4 operator - (<span class="keyword">const</span> Vector4& lhs, <a class="code" href="namespaceOgre.html#a465">Real</a> rhs) |
---|
| 271 | 00268 { |
---|
| 272 | 00269 Vector4 ret; |
---|
| 273 | 00270 ret = lhs; |
---|
| 274 | 00271 <span class="keywordflow">return</span> ret -= rhs; |
---|
| 275 | 00272 } |
---|
| 276 | 00273 |
---|
| 277 | <a name="l00274"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4n4">00274</a> <span class="keyword">inline</span> <span class="keyword">friend</span> Vector4 operator - (<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> lhs, <span class="keyword">const</span> Vector4& rhs) |
---|
| 278 | 00275 { |
---|
| 279 | 00276 Vector4 ret; |
---|
| 280 | 00277 ret = lhs; |
---|
| 281 | 00278 <span class="keywordflow">return</span> ret -= rhs; |
---|
| 282 | 00279 } |
---|
| 283 | 00280 |
---|
| 284 | 00281 <span class="comment">// arithmetic updates</span> |
---|
| 285 | <a name="l00282"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a21">00282</a> <span class="keyword">inline</span> Vector4& operator += ( <span class="keyword">const</span> Vector4& rkVector ) |
---|
| 286 | 00283 { |
---|
| 287 | 00284 x += rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a>; |
---|
| 288 | 00285 y += rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a>; |
---|
| 289 | 00286 z += rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a>; |
---|
| 290 | 00287 w += rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a>; |
---|
| 291 | 00288 |
---|
| 292 | 00289 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
| 293 | 00290 } |
---|
| 294 | 00291 |
---|
| 295 | <a name="l00292"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a22">00292</a> <span class="keyword">inline</span> Vector4& operator -= ( <span class="keyword">const</span> Vector4& rkVector ) |
---|
| 296 | 00293 { |
---|
| 297 | 00294 x -= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a>; |
---|
| 298 | 00295 y -= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a>; |
---|
| 299 | 00296 z -= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a>; |
---|
| 300 | 00297 w -= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a>; |
---|
| 301 | 00298 |
---|
| 302 | 00299 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
| 303 | 00300 } |
---|
| 304 | 00301 |
---|
| 305 | <a name="l00302"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a23">00302</a> <span class="keyword">inline</span> Vector4& operator *= ( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> fScalar ) |
---|
| 306 | 00303 { |
---|
| 307 | 00304 x *= fScalar; |
---|
| 308 | 00305 y *= fScalar; |
---|
| 309 | 00306 z *= fScalar; |
---|
| 310 | 00307 w *= fScalar; |
---|
| 311 | 00308 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
| 312 | 00309 } |
---|
| 313 | 00310 |
---|
| 314 | <a name="l00311"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a24">00311</a> <span class="keyword">inline</span> Vector4& operator += ( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> fScalar ) |
---|
| 315 | 00312 { |
---|
| 316 | 00313 x += fScalar; |
---|
| 317 | 00314 y += fScalar; |
---|
| 318 | 00315 z += fScalar; |
---|
| 319 | 00316 w += fScalar; |
---|
| 320 | 00317 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
| 321 | 00318 } |
---|
| 322 | 00319 |
---|
| 323 | <a name="l00320"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a25">00320</a> <span class="keyword">inline</span> Vector4& operator -= ( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> fScalar ) |
---|
| 324 | 00321 { |
---|
| 325 | 00322 x -= fScalar; |
---|
| 326 | 00323 y -= fScalar; |
---|
| 327 | 00324 z -= fScalar; |
---|
| 328 | 00325 w -= fScalar; |
---|
| 329 | 00326 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
| 330 | 00327 } |
---|
| 331 | 00328 |
---|
| 332 | <a name="l00329"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a26">00329</a> <span class="keyword">inline</span> Vector4& operator *= ( <span class="keyword">const</span> Vector4& rkVector ) |
---|
| 333 | 00330 { |
---|
| 334 | 00331 x *= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a>; |
---|
| 335 | 00332 y *= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a>; |
---|
| 336 | 00333 z *= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a>; |
---|
| 337 | 00334 w *= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a>; |
---|
| 338 | 00335 |
---|
| 339 | 00336 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
| 340 | 00337 } |
---|
| 341 | 00338 |
---|
| 342 | <a name="l00339"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a27">00339</a> <span class="keyword">inline</span> Vector4& operator /= ( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a465">Real</a> fScalar ) |
---|
| 343 | 00340 { |
---|
| 344 | 00341 assert( fScalar != 0.0 ); |
---|
| 345 | 00342 |
---|
| 346 | 00343 <a class="code" href="namespaceOgre.html#a465">Real</a> fInv = 1.0 / fScalar; |
---|
| 347 | 00344 |
---|
| 348 | 00345 x *= fInv; |
---|
| 349 | 00346 y *= fInv; |
---|
| 350 | 00347 z *= fInv; |
---|
| 351 | 00348 w *= fInv; |
---|
| 352 | 00349 |
---|
| 353 | 00350 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
| 354 | 00351 } |
---|
| 355 | 00352 |
---|
| 356 | <a name="l00353"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a28">00353</a> <span class="keyword">inline</span> Vector4& operator /= ( <span class="keyword">const</span> Vector4& rkVector ) |
---|
| 357 | 00354 { |
---|
| 358 | 00355 x /= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a>; |
---|
| 359 | 00356 y /= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a>; |
---|
| 360 | 00357 z /= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a>; |
---|
| 361 | 00358 w /= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a>; |
---|
| 362 | 00359 |
---|
| 363 | 00360 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
| 364 | 00361 } |
---|
| 365 | 00362 |
---|
| 366 | <a name="l00370"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a29">00370</a> <span class="keyword">inline</span> <a class="code" href="namespaceOgre.html#a465">Real</a> dotProduct(<span class="keyword">const</span> Vector4& vec)<span class="keyword"> const</span> |
---|
| 367 | 00371 <span class="keyword"> </span>{ |
---|
| 368 | 00372 <span class="keywordflow">return</span> x * vec.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> + y * vec.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> + z * vec.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> + w * vec.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a>; |
---|
| 369 | 00373 } |
---|
| 370 | 00376 <span class="keyword">inline</span> <a class="code" href="class__OgreExport.html">_OgreExport</a> <span class="keyword">friend</span> std::ostream& <span class="keyword">operator</span> << |
---|
| 371 | <a name="l00377"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4n5">00377</a> ( std::ostream& o, <span class="keyword">const</span> Vector4& v ) |
---|
| 372 | 00378 { |
---|
| 373 | 00379 o << <span class="stringliteral">"Vector4("</span> << v.x << <span class="stringliteral">", "</span> << v.y << <span class="stringliteral">", "</span> << v.z << <span class="stringliteral">", "</span> << v.w << <span class="stringliteral">")"</span>; |
---|
| 374 | 00380 <span class="keywordflow">return</span> o; |
---|
| 375 | 00381 } |
---|
| 376 | 00382 <span class="comment">// special</span> |
---|
| 377 | <a name="l00383"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4s0">00383</a> <span class="keyword">static</span> <span class="keyword">const</span> Vector4 ZERO; |
---|
| 378 | 00384 }; |
---|
| 379 | 00385 |
---|
| 380 | 00386 } |
---|
| 381 | 00387 <span class="preprocessor">#endif</span> |
---|
| 382 | </pre></div><hr> |
---|
| 383 | <p> |
---|
| 384 | Copyright © 2000-2005 by The OGRE Team<br /> |
---|
| 385 | <!--Creative Commons License--><a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/"><img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights20.png"/></a><br/> |
---|
| 386 | This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-ShareAlike 2.5 License</a>.<br/> |
---|
| 387 | <!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> |
---|
| 388 | <Work rdf:about=""> |
---|
| 389 | <license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" /> |
---|
| 390 | <dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" /> |
---|
| 391 | </Work> |
---|
| 392 | <License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License></rdf:RDF> --> |
---|
| 393 | |
---|
| 394 | Last modified Sun Mar 12 14:37:51 2006 |
---|
| 395 | </p> |
---|
| 396 | </body> |
---|
| 397 | </html> |
---|