File: qquaternion.html

package info (click to toggle)
qt4-x11 4%3A4.8.2%2Bdfsg-11
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 701,696 kB
  • sloc: cpp: 2,686,179; ansic: 375,485; python: 25,859; sh: 19,349; xml: 17,091; perl: 14,765; yacc: 5,383; asm: 5,038; makefile: 1,259; lex: 555; ruby: 526; objc: 347; cs: 112; pascal: 112; php: 54; sed: 34
file content (369 lines) | stat: -rw-r--r-- 38,822 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquaternion.cpp -->
  <title>Qt 4.8: QQuaternion Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="content"> 
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
  </div>
  <div class="breadcrumb toolblock">
    <ul>
      <li class="first"><a href="index.html">Home</a></li>
      <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QQuaternion</li>
    </ul>
  </div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QQuaternion Class Reference</h1>
<!-- $$$QQuaternion-brief -->
<p>The QQuaternion class represents a quaternion consisting of a vector and scalar. <a href="#details">More...</a></p>
<!-- @@@QQuaternion -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QQuaternion&gt;</span></pre><p>This class was introduced in Qt 4.6.</p>
<ul>
<li><a href="qquaternion-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#QQuaternion">QQuaternion</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#QQuaternion-2">QQuaternion</a></b> ( qreal <i>scalar</i>, qreal <i>xpos</i>, qreal <i>ypos</i>, qreal <i>zpos</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#QQuaternion-3">QQuaternion</a></b> ( qreal <i>scalar</i>, const QVector3D &amp; <i>vector</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#QQuaternion-4">QQuaternion</a></b> ( const QVector4D &amp; <i>vector</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QQuaternion </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#conjugate">conjugate</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#isIdentity">isIdentity</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#isNull">isNull</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#length">length</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#lengthSquared">lengthSquared</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#normalize">normalize</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QQuaternion </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#normalized">normalized</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVector3D </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#rotatedVector">rotatedVector</a></b> ( const QVector3D &amp; <i>vector</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#scalar">scalar</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#setScalar">setScalar</a></b> ( qreal <i>scalar</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#setVector">setVector</a></b> ( const QVector3D &amp; <i>vector</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#setVector-2">setVector</a></b> ( qreal <i>x</i>, qreal <i>y</i>, qreal <i>z</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#setX">setX</a></b> ( qreal <i>x</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#setY">setY</a></b> ( qreal <i>y</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#setZ">setZ</a></b> ( qreal <i>z</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVector4D </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#toVector4D">toVector4D</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVector3D </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#vector">vector</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#x">x</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#y">y</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#z">z</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator-QVariant">operator QVariant</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QQuaternion &amp; </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator-2a-eq">operator*=</a></b> ( qreal <i>factor</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QQuaternion &amp; </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator-2a-eq-2">operator*=</a></b> ( const QQuaternion &amp; <i>quaternion</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QQuaternion &amp; </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator-2b-eq">operator+=</a></b> ( const QQuaternion &amp; <i>quaternion</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QQuaternion &amp; </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator--eq">operator-=</a></b> ( const QQuaternion &amp; <i>quaternion</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QQuaternion &amp; </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator-2f-eq">operator/=</a></b> ( qreal <i>divisor</i> )</td></tr>
</table>
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QQuaternion </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#fromAxisAndAngle">fromAxisAndAngle</a></b> ( const QVector3D &amp; <i>axis</i>, qreal <i>angle</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QQuaternion </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#fromAxisAndAngle-2">fromAxisAndAngle</a></b> ( qreal <i>x</i>, qreal <i>y</i>, qreal <i>z</i>, qreal <i>angle</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QQuaternion </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#nlerp">nlerp</a></b> ( const QQuaternion &amp; <i>q1</i>, const QQuaternion &amp; <i>q2</i>, qreal <i>t</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QQuaternion </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#slerp">slerp</a></b> ( const QQuaternion &amp; <i>q1</i>, const QQuaternion &amp; <i>q2</i>, qreal <i>t</i> )</td></tr>
</table>
<a name="related-non-members"></a>
<h2>Related Non-Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#qFuzzyCompare-9">qFuzzyCompare</a></b> ( const QQuaternion &amp; <i>q1</i>, const QQuaternion &amp; <i>q2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator-not-eq-53">operator!=</a></b> ( const QQuaternion &amp; <i>q1</i>, const QQuaternion &amp; <i>q2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QQuaternion </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator-2a-51">operator*</a></b> ( const QQuaternion &amp; <i>q1</i>, const QQuaternion &amp; <i>q2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QQuaternion </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator-2a-52">operator*</a></b> ( qreal <i>factor</i>, const QQuaternion &amp; <i>quaternion</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QQuaternion </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator-2a-53">operator*</a></b> ( const QQuaternion &amp; <i>quaternion</i>, qreal <i>factor</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QQuaternion </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator-2b-36">operator+</a></b> ( const QQuaternion &amp; <i>q1</i>, const QQuaternion &amp; <i>q2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QQuaternion </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator--16">operator-</a></b> ( const QQuaternion &amp; <i>q1</i>, const QQuaternion &amp; <i>q2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QQuaternion </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator--17">operator-</a></b> ( const QQuaternion &amp; <i>quaternion</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QQuaternion </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator-2f-10">operator/</a></b> ( const QQuaternion &amp; <i>quaternion</i>, qreal <i>divisor</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator-lt-lt-190">operator&lt;&lt;</a></b> ( QDataStream &amp; <i>stream</i>, const QQuaternion &amp; <i>quaternion</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator-eq-eq-79">operator==</a></b> ( const QQuaternion &amp; <i>q1</i>, const QQuaternion &amp; <i>q2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator-gt-gt-102">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>stream</i>, QQuaternion &amp; <i>quaternion</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="qquaternion.html#operator-gt-gt-20">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>stream</i>, QEasingCurve &amp; <i>easing</i> )</td></tr>
</table>
<a name="details"></a>
<!-- $$$QQuaternion-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QQuaternion class represents a quaternion consisting of a vector and scalar.</p>
<p>Quaternions are used to represent rotations in 3D space, and consist of a 3D rotation axis specified by the x, y, and z coordinates, and a scalar representing the rotation angle.</p>
</div>
<!-- @@@QQuaternion -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QQuaternion[overload1]$$$QQuaternion -->
<h3 class="fn"><a name="QQuaternion"></a>QQuaternion::<span class="name">QQuaternion</span> ()</h3>
<p>Constructs an identity quaternion, i.e&#x2e; with coordinates (1, 0, 0, 0).</p>
<!-- @@@QQuaternion -->
<!-- $$$QQuaternion$$$QQuaternionqrealqrealqrealqreal -->
<h3 class="fn"><a name="QQuaternion-2"></a>QQuaternion::<span class="name">QQuaternion</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>scalar</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>xpos</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>ypos</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>zpos</i> )</h3>
<p>Constructs a quaternion with the vector (<i>xpos</i>, <i>ypos</i>, <i>zpos</i>) and <i>scalar</i>.</p>
<!-- @@@QQuaternion -->
<!-- $$$QQuaternion$$$QQuaternionqrealconstQVector3D& -->
<h3 class="fn"><a name="QQuaternion-3"></a>QQuaternion::<span class="name">QQuaternion</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>scalar</i>, const <span class="type"><a href="qvector3d.html">QVector3D</a></span> &amp; <i>vector</i> )</h3>
<p>Constructs a quaternion vector from the specified <i>vector</i> and <i>scalar</i>.</p>
<p><b>See also </b><a href="qquaternion.html#vector">vector</a>() and <a href="qquaternion.html#scalar">scalar</a>().</p>
<!-- @@@QQuaternion -->
<!-- $$$QQuaternion$$$QQuaternionconstQVector4D& -->
<h3 class="fn"><a name="QQuaternion-4"></a>QQuaternion::<span class="name">QQuaternion</span> ( const <span class="type"><a href="qvector4d.html">QVector4D</a></span> &amp; <i>vector</i> )</h3>
<p>Constructs a quaternion from the components of <i>vector</i>.</p>
<!-- @@@QQuaternion -->
<!-- $$$conjugate[overload1]$$$conjugate -->
<h3 class="fn"><a name="conjugate"></a><span class="type">QQuaternion</span> QQuaternion::<span class="name">conjugate</span> () const</h3>
<p>Returns the conjugate of this quaternion, which is (-x, -y, -z, scalar).</p>
<!-- @@@conjugate -->
<!-- $$$fromAxisAndAngle[overload1]$$$fromAxisAndAngleconstQVector3D&qreal -->
<h3 class="fn"><a name="fromAxisAndAngle"></a><span class="type">QQuaternion</span> QQuaternion::<span class="name">fromAxisAndAngle</span> ( const <span class="type"><a href="qvector3d.html">QVector3D</a></span> &amp; <i>axis</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>angle</i> )<tt> [static]</tt></h3>
<p>Creates a normalized quaternion that corresponds to rotating through <i>angle</i> degrees about the specified 3D <i>axis</i>.</p>
<!-- @@@fromAxisAndAngle -->
<!-- $$$fromAxisAndAngle$$$fromAxisAndAngleqrealqrealqrealqreal -->
<h3 class="fn"><a name="fromAxisAndAngle-2"></a><span class="type">QQuaternion</span> QQuaternion::<span class="name">fromAxisAndAngle</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>z</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>angle</i> )<tt> [static]</tt></h3>
<p>Creates a normalized quaternion that corresponds to rotating through <i>angle</i> degrees about the 3D axis (<i>x</i>, <i>y</i>, <i>z</i>).</p>
<!-- @@@fromAxisAndAngle -->
<!-- $$$isIdentity[overload1]$$$isIdentity -->
<h3 class="fn"><a name="isIdentity"></a><span class="type">bool</span> QQuaternion::<span class="name">isIdentity</span> () const</h3>
<p>Returns true if the x, y, and z components of this quaternion are set to 0.0, and the scalar component is set to 1.0; otherwise returns false.</p>
<!-- @@@isIdentity -->
<!-- $$$isNull[overload1]$$$isNull -->
<h3 class="fn"><a name="isNull"></a><span class="type">bool</span> QQuaternion::<span class="name">isNull</span> () const</h3>
<p>Returns true if the x, y, z, and scalar components of this quaternion are set to 0.0; otherwise returns false.</p>
<!-- @@@isNull -->
<!-- $$$length[overload1]$$$length -->
<h3 class="fn"><a name="length"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QQuaternion::<span class="name">length</span> () const</h3>
<p>Returns the length of the quaternion. This is also called the &quot;norm&quot;.</p>
<p><b>See also </b><a href="qquaternion.html#lengthSquared">lengthSquared</a>() and <a href="qquaternion.html#normalized">normalized</a>().</p>
<!-- @@@length -->
<!-- $$$lengthSquared[overload1]$$$lengthSquared -->
<h3 class="fn"><a name="lengthSquared"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QQuaternion::<span class="name">lengthSquared</span> () const</h3>
<p>Returns the squared length of the quaternion.</p>
<p><b>See also </b><a href="qquaternion.html#length">length</a>().</p>
<!-- @@@lengthSquared -->
<!-- $$$nlerp[overload1]$$$nlerpconstQQuaternion&constQQuaternion&qreal -->
<h3 class="fn"><a name="nlerp"></a><span class="type">QQuaternion</span> QQuaternion::<span class="name">nlerp</span> ( const <span class="type">QQuaternion</span> &amp; <i>q1</i>, const <span class="type">QQuaternion</span> &amp; <i>q2</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>t</i> )<tt> [static]</tt></h3>
<p>Interpolates along the shortest linear path between the rotational positions <i>q1</i> and <i>q2</i>. The value <i>t</i> should be between 0 and 1, indicating the distance to travel between <i>q1</i> and <i>q2</i>. The result will be <a href="qquaternion.html#normalized">normalized</a>().</p>
<p>If <i>t</i> is less than or equal to 0, then <i>q1</i> will be returned. If <i>t</i> is greater than or equal to 1, then <i>q2</i> will be returned.</p>
<p>The nlerp() function is typically faster than <a href="qquaternion.html#slerp">slerp</a>() and will give approximate results to spherical interpolation that are good enough for some applications.</p>
<p><b>See also </b><a href="qquaternion.html#slerp">slerp</a>().</p>
<!-- @@@nlerp -->
<!-- $$$normalize[overload1]$$$normalize -->
<h3 class="fn"><a name="normalize"></a><span class="type">void</span> QQuaternion::<span class="name">normalize</span> ()</h3>
<p>Normalizes the currect quaternion in place. Nothing happens if this is a null quaternion or the length of the quaternion is very close to 1.</p>
<p><b>See also </b><a href="qquaternion.html#length">length</a>() and <a href="qquaternion.html#normalized">normalized</a>().</p>
<!-- @@@normalize -->
<!-- $$$normalized[overload1]$$$normalized -->
<h3 class="fn"><a name="normalized"></a><span class="type">QQuaternion</span> QQuaternion::<span class="name">normalized</span> () const</h3>
<p>Returns the normalized unit form of this quaternion.</p>
<p>If this quaternion is null, then a null quaternion is returned. If the length of the quaternion is very close to 1, then the quaternion will be returned as-is. Otherwise the normalized form of the quaternion of length 1 will be returned.</p>
<p><b>See also </b><a href="qquaternion.html#length">length</a>() and <a href="qquaternion.html#normalize">normalize</a>().</p>
<!-- @@@normalized -->
<!-- $$$rotatedVector[overload1]$$$rotatedVectorconstQVector3D& -->
<h3 class="fn"><a name="rotatedVector"></a><span class="type"><a href="qvector3d.html">QVector3D</a></span> QQuaternion::<span class="name">rotatedVector</span> ( const <span class="type"><a href="qvector3d.html">QVector3D</a></span> &amp; <i>vector</i> ) const</h3>
<p>Rotates <i>vector</i> with this quaternion to produce a new vector in 3D space. The following code:</p>
<pre class="cpp"> QVector3D result <span class="operator">=</span> q<span class="operator">.</span>rotatedVector(vector);</pre>
<p>is equivalent to the following:</p>
<pre class="cpp"> QVector3D result <span class="operator">=</span> (q <span class="operator">*</span> <span class="type"><a href="qquaternion.html">QQuaternion</a></span>(<span class="number">0</span><span class="operator">,</span> vector) <span class="operator">*</span> q<span class="operator">.</span>conjugate())<span class="operator">.</span><a href="qquaternion.html#vector">vector</a>();</pre>
<!-- @@@rotatedVector -->
<!-- $$$scalar[overload1]$$$scalar -->
<h3 class="fn"><a name="scalar"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QQuaternion::<span class="name">scalar</span> () const</h3>
<p>Returns the scalar component of this quaternion.</p>
<p><b>See also </b><a href="qquaternion.html#setScalar">setScalar</a>(), <a href="qquaternion.html#x">x</a>(), <a href="qquaternion.html#y">y</a>(), and <a href="qquaternion.html#z">z</a>().</p>
<!-- @@@scalar -->
<!-- $$$setScalar[overload1]$$$setScalarqreal -->
<h3 class="fn"><a name="setScalar"></a><span class="type">void</span> QQuaternion::<span class="name">setScalar</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>scalar</i> )</h3>
<p>Sets the scalar component of this quaternion to <i>scalar</i>.</p>
<p><b>See also </b><a href="qquaternion.html#scalar">scalar</a>(), <a href="qquaternion.html#setX">setX</a>(), <a href="qquaternion.html#setY">setY</a>(), and <a href="qquaternion.html#setZ">setZ</a>().</p>
<!-- @@@setScalar -->
<!-- $$$setVector[overload1]$$$setVectorconstQVector3D& -->
<h3 class="fn"><a name="setVector"></a><span class="type">void</span> QQuaternion::<span class="name">setVector</span> ( const <span class="type"><a href="qvector3d.html">QVector3D</a></span> &amp; <i>vector</i> )</h3>
<p>Sets the vector component of this quaternion to <i>vector</i>.</p>
<p><b>See also </b><a href="qquaternion.html#vector">vector</a>() and <a href="qquaternion.html#setScalar">setScalar</a>().</p>
<!-- @@@setVector -->
<!-- $$$setVector$$$setVectorqrealqrealqreal -->
<h3 class="fn"><a name="setVector-2"></a><span class="type">void</span> QQuaternion::<span class="name">setVector</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>z</i> )</h3>
<p>Sets the vector component of this quaternion to (<i>x</i>, <i>y</i>, <i>z</i>).</p>
<p><b>See also </b><a href="qquaternion.html#vector">vector</a>() and <a href="qquaternion.html#setScalar">setScalar</a>().</p>
<!-- @@@setVector -->
<!-- $$$setX[overload1]$$$setXqreal -->
<h3 class="fn"><a name="setX"></a><span class="type">void</span> QQuaternion::<span class="name">setX</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i> )</h3>
<p>Sets the x coordinate of this quaternion's vector to the given <i>x</i> coordinate.</p>
<p><b>See also </b><a href="qquaternion.html#x">x</a>(), <a href="qquaternion.html#setY">setY</a>(), <a href="qquaternion.html#setZ">setZ</a>(), and <a href="qquaternion.html#setScalar">setScalar</a>().</p>
<!-- @@@setX -->
<!-- $$$setY[overload1]$$$setYqreal -->
<h3 class="fn"><a name="setY"></a><span class="type">void</span> QQuaternion::<span class="name">setY</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i> )</h3>
<p>Sets the y coordinate of this quaternion's vector to the given <i>y</i> coordinate.</p>
<p><b>See also </b><a href="qquaternion.html#y">y</a>(), <a href="qquaternion.html#setX">setX</a>(), <a href="qquaternion.html#setZ">setZ</a>(), and <a href="qquaternion.html#setScalar">setScalar</a>().</p>
<!-- @@@setY -->
<!-- $$$setZ[overload1]$$$setZqreal -->
<h3 class="fn"><a name="setZ"></a><span class="type">void</span> QQuaternion::<span class="name">setZ</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>z</i> )</h3>
<p>Sets the z coordinate of this quaternion's vector to the given <i>z</i> coordinate.</p>
<p><b>See also </b><a href="qquaternion.html#z">z</a>(), <a href="qquaternion.html#setX">setX</a>(), <a href="qquaternion.html#setY">setY</a>(), and <a href="qquaternion.html#setScalar">setScalar</a>().</p>
<!-- @@@setZ -->
<!-- $$$slerp[overload1]$$$slerpconstQQuaternion&constQQuaternion&qreal -->
<h3 class="fn"><a name="slerp"></a><span class="type">QQuaternion</span> QQuaternion::<span class="name">slerp</span> ( const <span class="type">QQuaternion</span> &amp; <i>q1</i>, const <span class="type">QQuaternion</span> &amp; <i>q2</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>t</i> )<tt> [static]</tt></h3>
<p>Interpolates along the shortest spherical path between the rotational positions <i>q1</i> and <i>q2</i>. The value <i>t</i> should be between 0 and 1, indicating the spherical distance to travel between <i>q1</i> and <i>q2</i>.</p>
<p>If <i>t</i> is less than or equal to 0, then <i>q1</i> will be returned. If <i>t</i> is greater than or equal to 1, then <i>q2</i> will be returned.</p>
<p><b>See also </b><a href="qquaternion.html#nlerp">nlerp</a>().</p>
<!-- @@@slerp -->
<!-- $$$toVector4D[overload1]$$$toVector4D -->
<h3 class="fn"><a name="toVector4D"></a><span class="type"><a href="qvector4d.html">QVector4D</a></span> QQuaternion::<span class="name">toVector4D</span> () const</h3>
<p>Returns this quaternion as a 4D vector.</p>
<!-- @@@toVector4D -->
<!-- $$$vector[overload1]$$$vector -->
<h3 class="fn"><a name="vector"></a><span class="type"><a href="qvector3d.html">QVector3D</a></span> QQuaternion::<span class="name">vector</span> () const</h3>
<p>Returns the vector component of this quaternion.</p>
<p><b>See also </b><a href="qquaternion.html#setVector">setVector</a>() and <a href="qquaternion.html#scalar">scalar</a>().</p>
<!-- @@@vector -->
<!-- $$$x[overload1]$$$x -->
<h3 class="fn"><a name="x"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QQuaternion::<span class="name">x</span> () const</h3>
<p>Returns the x coordinate of this quaternion's vector.</p>
<p><b>See also </b><a href="qquaternion.html#setX">setX</a>(), <a href="qquaternion.html#y">y</a>(), <a href="qquaternion.html#z">z</a>(), and <a href="qquaternion.html#scalar">scalar</a>().</p>
<!-- @@@x -->
<!-- $$$y[overload1]$$$y -->
<h3 class="fn"><a name="y"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QQuaternion::<span class="name">y</span> () const</h3>
<p>Returns the y coordinate of this quaternion's vector.</p>
<p><b>See also </b><a href="qquaternion.html#setY">setY</a>(), <a href="qquaternion.html#x">x</a>(), <a href="qquaternion.html#z">z</a>(), and <a href="qquaternion.html#scalar">scalar</a>().</p>
<!-- @@@y -->
<!-- $$$z[overload1]$$$z -->
<h3 class="fn"><a name="z"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QQuaternion::<span class="name">z</span> () const</h3>
<p>Returns the z coordinate of this quaternion's vector.</p>
<p><b>See also </b><a href="qquaternion.html#setZ">setZ</a>(), <a href="qquaternion.html#x">x</a>(), <a href="qquaternion.html#y">y</a>(), and <a href="qquaternion.html#scalar">scalar</a>().</p>
<!-- @@@z -->
<!-- $$$operator QVariant[overload1]$$$operator QVariant -->
<h3 class="fn"><a name="operator-QVariant"></a>QQuaternion::<span class="name">operator QVariant</span> () const</h3>
<p>Returns the quaternion as a <a href="qvariant.html">QVariant</a>.</p>
<!-- @@@operator QVariant -->
<!-- $$$operator*=[overload1]$$$operator*=qreal -->
<h3 class="fn"><a name="operator-2a-eq"></a><span class="type">QQuaternion</span> &amp; QQuaternion::<span class="name">operator*=</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>factor</i> )</h3>
<p>Multiplies this quaternion's components by the given <i>factor</i>, and returns a reference to this quaternion.</p>
<p><b>See also </b><a href="qquaternion.html#operator-2f-eq">operator/=</a>().</p>
<!-- @@@operator*= -->
<!-- $$$operator*=$$$operator*=constQQuaternion& -->
<h3 class="fn"><a name="operator-2a-eq-2"></a><span class="type">QQuaternion</span> &amp; QQuaternion::<span class="name">operator*=</span> ( const <span class="type">QQuaternion</span> &amp; <i>quaternion</i> )</h3>
<p>Multiplies this quaternion by <i>quaternion</i> and returns a reference to this quaternion.</p>
<!-- @@@operator*= -->
<!-- $$$operator+=[overload1]$$$operator+=constQQuaternion& -->
<h3 class="fn"><a name="operator-2b-eq"></a><span class="type">QQuaternion</span> &amp; QQuaternion::<span class="name">operator+=</span> ( const <span class="type">QQuaternion</span> &amp; <i>quaternion</i> )</h3>
<p>Adds the given <i>quaternion</i> to this quaternion and returns a reference to this quaternion.</p>
<p><b>See also </b><a href="qquaternion.html#operator--eq">operator-=</a>().</p>
<!-- @@@operator+= -->
<!-- $$$operator-=[overload1]$$$operator-=constQQuaternion& -->
<h3 class="fn"><a name="operator--eq"></a><span class="type">QQuaternion</span> &amp; QQuaternion::<span class="name">operator-=</span> ( const <span class="type">QQuaternion</span> &amp; <i>quaternion</i> )</h3>
<p>Subtracts the given <i>quaternion</i> from this quaternion and returns a reference to this quaternion.</p>
<p><b>See also </b><a href="qquaternion.html#operator-2b-eq">operator+=</a>().</p>
<!-- @@@operator-= -->
<!-- $$$operator/=[overload1]$$$operator/=qreal -->
<h3 class="fn"><a name="operator-2f-eq"></a><span class="type">QQuaternion</span> &amp; QQuaternion::<span class="name">operator/=</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>divisor</i> )</h3>
<p>Divides this quaternion's components by the given <i>divisor</i>, and returns a reference to this quaternion.</p>
<p><b>See also </b><a href="qquaternion.html#operator-2a-eq">operator*=</a>().</p>
<!-- @@@operator/= -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$qFuzzyCompare$$$qFuzzyCompareconstQQuaternion&constQQuaternion& -->
<h3 class="fn"><a name="qFuzzyCompare-9"></a><span class="type">bool</span> <span class="name">qFuzzyCompare</span> ( const <span class="type">QQuaternion</span> &amp; <i>q1</i>, const <span class="type">QQuaternion</span> &amp; <i>q2</i> )</h3>
<p>Returns true if <i>q1</i> and <i>q2</i> are equal, allowing for a small fuzziness factor for floating-point comparisons; false otherwise.</p>
<!-- @@@qFuzzyCompare -->
<!-- $$$operator!=$$$operator!=constQQuaternion&constQQuaternion& -->
<h3 class="fn"><a name="operator-not-eq-53"></a><span class="type">bool</span> <span class="name">operator!=</span> ( const <span class="type">QQuaternion</span> &amp; <i>q1</i>, const <span class="type">QQuaternion</span> &amp; <i>q2</i> )</h3>
<p>Returns true if <i>q1</i> is not equal to <i>q2</i>; otherwise returns false. This operator uses an exact floating-point comparison.</p>
<!-- @@@operator!= -->
<!-- $$$operator*$$$operator*constQQuaternion&constQQuaternion& -->
<h3 class="fn"><a name="operator-2a-51"></a>const <span class="type">QQuaternion</span> <span class="name">operator*</span> ( const <span class="type">QQuaternion</span> &amp; <i>q1</i>, const <span class="type">QQuaternion</span> &amp; <i>q2</i> )</h3>
<p>Multiplies <i>q1</i> and <i>q2</i> using quaternion multiplication. The result corresponds to applying both of the rotations specified by <i>q1</i> and <i>q2</i>.</p>
<p><b>See also </b><a href="qquaternion.html#operator-2a-eq">QQuaternion::operator*=</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*qrealconstQQuaternion& -->
<h3 class="fn"><a name="operator-2a-52"></a>const <span class="type">QQuaternion</span> <span class="name">operator*</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>factor</i>, const <span class="type">QQuaternion</span> &amp; <i>quaternion</i> )</h3>
<p>Returns a copy of the given <i>quaternion</i>, multiplied by the given <i>factor</i>.</p>
<p><b>See also </b><a href="qquaternion.html#operator-2a-eq">QQuaternion::operator*=</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQQuaternion&qreal -->
<h3 class="fn"><a name="operator-2a-53"></a>const <span class="type">QQuaternion</span> <span class="name">operator*</span> ( const <span class="type">QQuaternion</span> &amp; <i>quaternion</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>factor</i> )</h3>
<p>Returns a copy of the given <i>quaternion</i>, multiplied by the given <i>factor</i>.</p>
<p><b>See also </b><a href="qquaternion.html#operator-2a-eq">QQuaternion::operator*=</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator+$$$operator+constQQuaternion&constQQuaternion& -->
<h3 class="fn"><a name="operator-2b-36"></a>const <span class="type">QQuaternion</span> <span class="name">operator+</span> ( const <span class="type">QQuaternion</span> &amp; <i>q1</i>, const <span class="type">QQuaternion</span> &amp; <i>q2</i> )</h3>
<p>Returns a <a href="qquaternion.html">QQuaternion</a> object that is the sum of the given quaternions, <i>q1</i> and <i>q2</i>; each component is added separately.</p>
<p><b>See also </b><a href="qquaternion.html#operator-2b-eq">QQuaternion::operator+=</a>().</p>
<!-- @@@operator+ -->
<!-- $$$operator-$$$operator-constQQuaternion&constQQuaternion& -->
<h3 class="fn"><a name="operator--16"></a>const <span class="type">QQuaternion</span> <span class="name">operator-</span> ( const <span class="type">QQuaternion</span> &amp; <i>q1</i>, const <span class="type">QQuaternion</span> &amp; <i>q2</i> )</h3>
<p>Returns a <a href="qquaternion.html">QQuaternion</a> object that is formed by subtracting <i>q2</i> from <i>q1</i>; each component is subtracted separately.</p>
<p><b>See also </b><a href="qquaternion.html#operator--eq">QQuaternion::operator-=</a>().</p>
<!-- @@@operator- -->
<!-- $$$operator-$$$operator-constQQuaternion& -->
<h3 class="fn"><a name="operator--17"></a>const <span class="type">QQuaternion</span> <span class="name">operator-</span> ( const <span class="type">QQuaternion</span> &amp; <i>quaternion</i> )</h3>
<p>This is an overloaded function.</p>
<p>Returns a <a href="qquaternion.html">QQuaternion</a> object that is formed by changing the sign of all three components of the given <i>quaternion</i>.</p>
<p>Equivalent to <tt>QQuaternion(0,0,0,0) - quaternion</tt>.</p>
<!-- @@@operator- -->
<!-- $$$operator/$$$operator/constQQuaternion&qreal -->
<h3 class="fn"><a name="operator-2f-10"></a>const <span class="type">QQuaternion</span> <span class="name">operator/</span> ( const <span class="type">QQuaternion</span> &amp; <i>quaternion</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>divisor</i> )</h3>
<p>Returns the <a href="qquaternion.html">QQuaternion</a> object formed by dividing all components of the given <i>quaternion</i> by the given <i>divisor</i>.</p>
<p><b>See also </b><a href="qquaternion.html#operator-2f-eq">QQuaternion::operator/=</a>().</p>
<!-- @@@operator/ -->
<!-- $$$operator<<$$$operator<<QDataStream&constQQuaternion& -->
<h3 class="fn"><a name="operator-lt-lt-190"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <span class="name">operator&lt;&lt;</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>stream</i>, const <span class="type">QQuaternion</span> &amp; <i>quaternion</i> )</h3>
<p>Writes the given <i>quaternion</i> to the given <i>stream</i> and returns a reference to the stream.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator<< -->
<!-- $$$operator==$$$operator==constQQuaternion&constQQuaternion& -->
<h3 class="fn"><a name="operator-eq-eq-79"></a><span class="type">bool</span> <span class="name">operator==</span> ( const <span class="type">QQuaternion</span> &amp; <i>q1</i>, const <span class="type">QQuaternion</span> &amp; <i>q2</i> )</h3>
<p>Returns true if <i>q1</i> is equal to <i>q2</i>; otherwise returns false. This operator uses an exact floating-point comparison.</p>
<!-- @@@operator== -->
<!-- $$$operator>>$$$operator>>QDataStream&QQuaternion& -->
<h3 class="fn"><a name="operator-gt-gt-102"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <span class="name">operator&gt;&gt;</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>stream</i>, <span class="type">QQuaternion</span> &amp; <i>quaternion</i> )</h3>
<p>Reads a quaternion from the given <i>stream</i> into the given <i>quaternion</i> and returns a reference to the stream.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator>> -->
<!-- $$$operator>>$$$operator>>QDataStream&QEasingCurve& -->
<h3 class="fn"><a name="operator-gt-gt-20"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <span class="name">operator&gt;&gt;</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>stream</i>, <span class="type"><a href="qeasingcurve.html">QEasingCurve</a></span> &amp; <i>easing</i> )</h3>
<p>Reads an easing curve from the given <i>stream</i> into the given <i>easing</i> curve and returns a reference to the stream.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator>> -->
</div>
  <div class="ft">
    <span></span>
  </div>
</div> 
<div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2012 Nokia Corporation and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Nokia, Qt and their respective logos are trademarks of Nokia Corporation 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>