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#a420">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#a420">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( <a class="code" href="namespaceOgre.html#a420">Real</a> fX, <a class="code" href="namespaceOgre.html#a420">Real</a> fY, <a class="code" href="namespaceOgre.html#a420">Real</a> fZ, <a class="code" href="namespaceOgre.html#a420">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> Vector4( <a class="code" href="namespaceOgre.html#a420">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> Vector4( <span class="keywordtype">int</span> afCoordinate[4] ) |
---|
72 | 00065 { |
---|
73 | 00066 x = (<a class="code" href="namespaceOgre.html#a420">Real</a>)afCoordinate[0]; |
---|
74 | 00067 y = (<a class="code" href="namespaceOgre.html#a420">Real</a>)afCoordinate[1]; |
---|
75 | 00068 z = (<a class="code" href="namespaceOgre.html#a420">Real</a>)afCoordinate[2]; |
---|
76 | 00069 w = (<a class="code" href="namespaceOgre.html#a420">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> Vector4( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a420">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> Vector4( <span class="keyword">const</span> Vector4& rkVector ) |
---|
85 | 00078 : x( rkVector.x ), y( rkVector.y ), z( rkVector.z ), w (rkVector.w) |
---|
86 | 00079 { |
---|
87 | 00080 } |
---|
88 | 00081 |
---|
89 | <a name="l00082"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a6">00082</a> <span class="keyword">inline</span> <a class="code" href="namespaceOgre.html#a420">Real</a> operator [] ( size_t i )<span class="keyword"> const</span> |
---|
90 | 00083 <span class="keyword"> </span>{ |
---|
91 | 00084 assert( i < 4 ); |
---|
92 | 00085 |
---|
93 | 00086 <span class="keywordflow">return</span> *(&x+i); |
---|
94 | 00087 } |
---|
95 | 00088 |
---|
96 | <a name="l00089"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a7">00089</a> <span class="keyword">inline</span> <a class="code" href="namespaceOgre.html#a420">Real</a>& operator [] ( size_t i ) |
---|
97 | 00090 { |
---|
98 | 00091 assert( i < 4 ); |
---|
99 | 00092 |
---|
100 | 00093 <span class="keywordflow">return</span> *(&x+i); |
---|
101 | 00094 } |
---|
102 | 00095 |
---|
103 | <a name="l00100"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a8">00100</a> <span class="keyword">inline</span> Vector4& operator = ( <span class="keyword">const</span> Vector4& rkVector ) |
---|
104 | 00101 { |
---|
105 | 00102 x = rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a>; |
---|
106 | 00103 y = rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a>; |
---|
107 | 00104 z = rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a>; |
---|
108 | 00105 w = rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a>; |
---|
109 | 00106 |
---|
110 | 00107 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
111 | 00108 } |
---|
112 | 00109 |
---|
113 | <a name="l00110"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a9">00110</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespaceOgre.html#a618">operator == </a>( <span class="keyword">const</span> Vector4& rkVector )<span class="keyword"> const</span> |
---|
114 | 00111 <span class="keyword"> </span>{ |
---|
115 | 00112 <span class="keywordflow">return</span> ( x == rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> && |
---|
116 | 00113 y == rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> && |
---|
117 | 00114 z == rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> && |
---|
118 | 00115 w == rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> ); |
---|
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> <span class="keywordtype">bool</span> <a class="code" href="namespaceOgre.html#a619">operator != </a>( <span class="keyword">const</span> Vector4& rkVector )<span class="keyword"> const</span> |
---|
122 | 00119 <span class="keyword"> </span>{ |
---|
123 | 00120 <span class="keywordflow">return</span> ( x != rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> || |
---|
124 | 00121 y != rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> || |
---|
125 | 00122 z != rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> || |
---|
126 | 00123 w != rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> ); |
---|
127 | 00124 } |
---|
128 | 00125 |
---|
129 | <a name="l00126"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a11">00126</a> <span class="keyword">inline</span> Vector4& operator = (<span class="keyword">const</span> <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& rhs) |
---|
130 | 00127 { |
---|
131 | 00128 x = rhs.<a class="code" href="classOgre_1_1Vector3.html#Ogre_1_1Vector3o0">x</a>; |
---|
132 | 00129 y = rhs.<a class="code" href="classOgre_1_1Vector3.html#Ogre_1_1Vector3o1">y</a>; |
---|
133 | 00130 z = rhs.<a class="code" href="classOgre_1_1Vector3.html#Ogre_1_1Vector3o2">z</a>; |
---|
134 | 00131 w = 1.0f; |
---|
135 | 00132 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
136 | 00133 } |
---|
137 | 00134 |
---|
138 | 00135 <span class="comment">// arithmetic operations</span> |
---|
139 | <a name="l00136"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a12">00136</a> <span class="keyword">inline</span> Vector4 operator + ( <span class="keyword">const</span> Vector4& rkVector )<span class="keyword"> const</span> |
---|
140 | 00137 <span class="keyword"> </span>{ |
---|
141 | 00138 Vector4 kSum; |
---|
142 | 00139 |
---|
143 | 00140 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>; |
---|
144 | 00141 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>; |
---|
145 | 00142 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>; |
---|
146 | 00143 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>; |
---|
147 | 00144 |
---|
148 | 00145 <span class="keywordflow">return</span> kSum; |
---|
149 | 00146 } |
---|
150 | 00147 |
---|
151 | <a name="l00148"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a13">00148</a> <span class="keyword">inline</span> Vector4 operator - ( <span class="keyword">const</span> Vector4& rkVector )<span class="keyword"> const</span> |
---|
152 | 00149 <span class="keyword"> </span>{ |
---|
153 | 00150 Vector4 kDiff; |
---|
154 | 00151 |
---|
155 | 00152 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>; |
---|
156 | 00153 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>; |
---|
157 | 00154 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>; |
---|
158 | 00155 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>; |
---|
159 | 00156 |
---|
160 | 00157 <span class="keywordflow">return</span> kDiff; |
---|
161 | 00158 } |
---|
162 | 00159 |
---|
163 | <a name="l00160"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a14">00160</a> <span class="keyword">inline</span> Vector4 <a class="code" href="namespaceOgre.html#a612">operator * </a>( <a class="code" href="namespaceOgre.html#a420">Real</a> fScalar )<span class="keyword"> const</span> |
---|
164 | 00161 <span class="keyword"> </span>{ |
---|
165 | 00162 Vector4 kProd; |
---|
166 | 00163 |
---|
167 | 00164 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> = fScalar*x; |
---|
168 | 00165 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> = fScalar*y; |
---|
169 | 00166 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> = fScalar*z; |
---|
170 | 00167 kProd.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> = fScalar*w; |
---|
171 | 00168 |
---|
172 | 00169 <span class="keywordflow">return</span> kProd; |
---|
173 | 00170 } |
---|
174 | 00171 |
---|
175 | <a name="l00172"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a15">00172</a> <span class="keyword">inline</span> Vector4 <a class="code" href="namespaceOgre.html#a612">operator * </a>( <span class="keyword">const</span> Vector4& rhs)<span class="keyword"> const</span> |
---|
176 | 00173 <span class="keyword"> </span>{ |
---|
177 | 00174 Vector4 kProd; |
---|
178 | 00175 |
---|
179 | 00176 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; |
---|
180 | 00177 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; |
---|
181 | 00178 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; |
---|
182 | 00179 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; |
---|
183 | 00180 |
---|
184 | 00181 <span class="keywordflow">return</span> kProd; |
---|
185 | 00182 } |
---|
186 | 00183 |
---|
187 | <a name="l00184"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a16">00184</a> <span class="keyword">inline</span> Vector4 <a class="code" href="namespaceOgre.html#a613">operator / </a>( <a class="code" href="namespaceOgre.html#a420">Real</a> fScalar )<span class="keyword"> const</span> |
---|
188 | 00185 <span class="keyword"> </span>{ |
---|
189 | 00186 assert( fScalar != 0.0 ); |
---|
190 | 00187 |
---|
191 | 00188 Vector4 kDiv; |
---|
192 | 00189 |
---|
193 | 00190 <a class="code" href="namespaceOgre.html#a420">Real</a> fInv = 1.0 / fScalar; |
---|
194 | 00191 kDiv.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> = x * fInv; |
---|
195 | 00192 kDiv.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> = y * fInv; |
---|
196 | 00193 kDiv.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> = z * fInv; |
---|
197 | 00194 kDiv.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> = w * fInv; |
---|
198 | 00195 |
---|
199 | 00196 <span class="keywordflow">return</span> kDiv; |
---|
200 | 00197 } |
---|
201 | 00198 |
---|
202 | <a name="l00199"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a17">00199</a> <span class="keyword">inline</span> Vector4 <a class="code" href="namespaceOgre.html#a613">operator / </a>( <span class="keyword">const</span> Vector4& rhs)<span class="keyword"> const</span> |
---|
203 | 00200 <span class="keyword"> </span>{ |
---|
204 | 00201 Vector4 kDiv; |
---|
205 | 00202 |
---|
206 | 00203 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>; |
---|
207 | 00204 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>; |
---|
208 | 00205 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>; |
---|
209 | 00206 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>; |
---|
210 | 00207 |
---|
211 | 00208 <span class="keywordflow">return</span> kDiv; |
---|
212 | 00209 } |
---|
213 | 00210 |
---|
214 | 00211 |
---|
215 | <a name="l00212"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a18">00212</a> <span class="keyword">inline</span> Vector4 operator - ()<span class="keyword"> const</span> |
---|
216 | 00213 <span class="keyword"> </span>{ |
---|
217 | 00214 Vector4 kNeg; |
---|
218 | 00215 |
---|
219 | 00216 kNeg.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a> = -x; |
---|
220 | 00217 kNeg.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a> = -y; |
---|
221 | 00218 kNeg.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a> = -z; |
---|
222 | 00219 kNeg.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a> = -w; |
---|
223 | 00220 |
---|
224 | 00221 <span class="keywordflow">return</span> kNeg; |
---|
225 | 00222 } |
---|
226 | 00223 |
---|
227 | <a name="l00224"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4n0">00224</a> <span class="keyword">inline</span> <span class="keyword">friend</span> Vector4 <a class="code" href="namespaceOgre.html#a612">operator * </a>( <a class="code" href="namespaceOgre.html#a420">Real</a> fScalar, <span class="keyword">const</span> Vector4& rkVector ) |
---|
228 | 00225 { |
---|
229 | 00226 Vector4 kProd; |
---|
230 | 00227 |
---|
231 | 00228 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>; |
---|
232 | 00229 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>; |
---|
233 | 00230 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>; |
---|
234 | 00231 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>; |
---|
235 | 00232 |
---|
236 | 00233 <span class="keywordflow">return</span> kProd; |
---|
237 | 00234 } |
---|
238 | 00235 |
---|
239 | 00236 <span class="comment">// arithmetic updates</span> |
---|
240 | <a name="l00237"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a19">00237</a> <span class="keyword">inline</span> Vector4& operator += ( <span class="keyword">const</span> Vector4& rkVector ) |
---|
241 | 00238 { |
---|
242 | 00239 x += rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a>; |
---|
243 | 00240 y += rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a>; |
---|
244 | 00241 z += rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a>; |
---|
245 | 00242 w += rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a>; |
---|
246 | 00243 |
---|
247 | 00244 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
248 | 00245 } |
---|
249 | 00246 |
---|
250 | <a name="l00247"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a20">00247</a> <span class="keyword">inline</span> Vector4& operator -= ( <span class="keyword">const</span> Vector4& rkVector ) |
---|
251 | 00248 { |
---|
252 | 00249 x -= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a>; |
---|
253 | 00250 y -= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a>; |
---|
254 | 00251 z -= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a>; |
---|
255 | 00252 w -= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a>; |
---|
256 | 00253 |
---|
257 | 00254 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
258 | 00255 } |
---|
259 | 00256 |
---|
260 | <a name="l00257"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a21">00257</a> <span class="keyword">inline</span> Vector4& operator *= ( <a class="code" href="namespaceOgre.html#a420">Real</a> fScalar ) |
---|
261 | 00258 { |
---|
262 | 00259 x *= fScalar; |
---|
263 | 00260 y *= fScalar; |
---|
264 | 00261 z *= fScalar; |
---|
265 | 00262 w *= fScalar; |
---|
266 | 00263 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
267 | 00264 } |
---|
268 | 00265 |
---|
269 | <a name="l00266"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a22">00266</a> <span class="keyword">inline</span> Vector4& operator *= ( <span class="keyword">const</span> Vector4& rkVector ) |
---|
270 | 00267 { |
---|
271 | 00268 x *= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a>; |
---|
272 | 00269 y *= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a>; |
---|
273 | 00270 z *= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a>; |
---|
274 | 00271 w *= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a>; |
---|
275 | 00272 |
---|
276 | 00273 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
277 | 00274 } |
---|
278 | 00275 |
---|
279 | <a name="l00276"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a23">00276</a> <span class="keyword">inline</span> Vector4& operator /= ( <a class="code" href="namespaceOgre.html#a420">Real</a> fScalar ) |
---|
280 | 00277 { |
---|
281 | 00278 assert( fScalar != 0.0 ); |
---|
282 | 00279 |
---|
283 | 00280 <a class="code" href="namespaceOgre.html#a420">Real</a> fInv = 1.0 / fScalar; |
---|
284 | 00281 |
---|
285 | 00282 x *= fInv; |
---|
286 | 00283 y *= fInv; |
---|
287 | 00284 z *= fInv; |
---|
288 | 00285 w *= fInv; |
---|
289 | 00286 |
---|
290 | 00287 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
291 | 00288 } |
---|
292 | 00289 |
---|
293 | <a name="l00290"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a24">00290</a> <span class="keyword">inline</span> Vector4& operator /= ( <span class="keyword">const</span> Vector4& rkVector ) |
---|
294 | 00291 { |
---|
295 | 00292 x /= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o0">x</a>; |
---|
296 | 00293 y /= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o1">y</a>; |
---|
297 | 00294 z /= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o2">z</a>; |
---|
298 | 00295 w /= rkVector.<a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4o3">w</a>; |
---|
299 | 00296 |
---|
300 | 00297 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
301 | 00298 } |
---|
302 | 00299 |
---|
303 | <a name="l00307"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4a25">00307</a> <span class="keyword">inline</span> <a class="code" href="namespaceOgre.html#a420">Real</a> dotProduct(<span class="keyword">const</span> Vector4& vec)<span class="keyword"> const</span> |
---|
304 | 00308 <span class="keyword"> </span>{ |
---|
305 | 00309 <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>; |
---|
306 | 00310 } |
---|
307 | 00313 <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> << |
---|
308 | <a name="l00314"></a><a class="code" href="classOgre_1_1Vector4.html#Ogre_1_1Vector4n1">00314</a> ( std::ostream& o, <span class="keyword">const</span> Vector4& v ) |
---|
309 | 00315 { |
---|
310 | 00316 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>; |
---|
311 | 00317 <span class="keywordflow">return</span> o; |
---|
312 | 00318 } |
---|
313 | 00319 }; |
---|
314 | 00320 |
---|
315 | 00321 } |
---|
316 | 00322 <span class="preprocessor">#endif</span> |
---|
317 | </pre></div><hr> |
---|
318 | <p> |
---|
319 | Copyright © 2000-2005 by The OGRE Team<br /> |
---|
320 | <!--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/> |
---|
321 | 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/> |
---|
322 | <!--/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#"> |
---|
323 | <Work rdf:about=""> |
---|
324 | <license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" /> |
---|
325 | <dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" /> |
---|
326 | </Work> |
---|
327 | <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> --> |
---|
328 | |
---|
329 | Last modified Sun Feb 12 12:59:54 2006 |
---|
330 | </p> |
---|
331 | </body> |
---|
332 | </html> |
---|