This file is indexed.

/usr/share/gtk-doc/html/cogl-2.0-experimental/cogl-2.0-experimental-Quaternions-(Rotations).html is in libcogl-doc 1.10.0-0ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Quaternions (Rotations)</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="Cogl 2.0 Reference Manual">
<link rel="up" href="cogl-utilities.html" title="Utilities">
<link rel="prev" href="cogl-2.0-experimental-3-Component-Vectors.html" title="3 Component Vectors">
<link rel="next" href="cogl-2.0-experimental-Common-Types.html" title="Common Types">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="cogl-2.0-experimental-3-Component-Vectors.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="cogl-utilities.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Cogl 2.0 Reference Manual</th>
<td><a accesskey="n" href="cogl-2.0-experimental-Common-Types.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#cogl-2.0-experimental-Quaternions-(Rotations).synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#cogl-2.0-experimental-Quaternions-(Rotations).description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="cogl-2.0-experimental-Quaternions-(Rotations)"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="cogl-2.0-experimental-Quaternions-(Rotations).top_of_page"></a>Quaternions (Rotations)</span></h2>
<p>Quaternions (Rotations) — Functions for initializing and manipulating
quaternions.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="cogl-2.0-experimental-Quaternions-(Rotations).synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">                    <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion">CoglQuaternion</a>;
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-init-identity" title="cogl_quaternion_init_identity ()">cogl_quaternion_init_identity</a>       (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-init" title="cogl_quaternion_init ()">cogl_quaternion_init</a>                (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> angle</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> x</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> y</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> z</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-init-from-angle-vector" title="cogl_quaternion_init_from_angle_vector ()">cogl_quaternion_init_from_angle_vector</a>
                                                        (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> angle</code></em>,
                                                         <em class="parameter"><code>const <span class="type">float</span> *axis3f</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-init-from-array" title="cogl_quaternion_init_from_array ()">cogl_quaternion_init_from_array</a>     (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code>const <span class="type">float</span> *array</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-init-from-x-rotation" title="cogl_quaternion_init_from_x_rotation ()">cogl_quaternion_init_from_x_rotation</a>
                                                        (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> angle</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-init-from-y-rotation" title="cogl_quaternion_init_from_y_rotation ()">cogl_quaternion_init_from_y_rotation</a>
                                                        (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> angle</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-init-from-z-rotation" title="cogl_quaternion_init_from_z_rotation ()">cogl_quaternion_init_from_z_rotation</a>
                                                        (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> angle</code></em>);
<span class="returnvalue">gboolean</span>            <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-equal" title="cogl_quaternion_equal ()">cogl_quaternion_equal</a>               (<em class="parameter"><code><span class="type">gconstpointer</span> v1</code></em>,
                                                         <em class="parameter"><code><span class="type">gconstpointer</span> v2</code></em>);
<a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="returnvalue">CoglQuaternion</span></a> *    <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-copy" title="cogl_quaternion_copy ()">cogl_quaternion_copy</a>                (<em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *src</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-free" title="cogl_quaternion_free ()">cogl_quaternion_free</a>                (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>);
<span class="returnvalue">float</span>               <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-get-rotation-angle" title="cogl_quaternion_get_rotation_angle ()">cogl_quaternion_get_rotation_angle</a>  (<em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-get-rotation-axis" title="cogl_quaternion_get_rotation_axis ()">cogl_quaternion_get_rotation_axis</a>   (<em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> *vector3</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-normalize" title="cogl_quaternion_normalize ()">cogl_quaternion_normalize</a>           (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>);
<span class="returnvalue">float</span>               <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-dot-product" title="cogl_quaternion_dot_product ()">cogl_quaternion_dot_product</a>         (<em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *a</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *b</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-invert" title="cogl_quaternion_invert ()">cogl_quaternion_invert</a>              (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-multiply" title="cogl_quaternion_multiply ()">cogl_quaternion_multiply</a>            (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *result</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *left</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *right</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-pow" title="cogl_quaternion_pow ()">cogl_quaternion_pow</a>                 (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> exponent</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-slerp" title="cogl_quaternion_slerp ()">cogl_quaternion_slerp</a>               (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *result</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *a</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *b</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> t</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-nlerp" title="cogl_quaternion_nlerp ()">cogl_quaternion_nlerp</a>               (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *result</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *a</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *b</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> t</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-squad" title="cogl_quaternion_squad ()">cogl_quaternion_squad</a>               (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *result</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *prev</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *a</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *b</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *next</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> t</code></em>);
const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="returnvalue">CoglQuaternion</span></a> * <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-get-static-identity-quaternion" title="cogl_get_static_identity_quaternion ()">cogl_get_static_identity_quaternion</a>
                                                        (<em class="parameter"><code><span class="type">void</span></code></em>);
const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="returnvalue">CoglQuaternion</span></a> * <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-get-static-zero-quaternion" title="cogl_get_static_zero_quaternion ()">cogl_get_static_zero_quaternion</a>  (<em class="parameter"><code><span class="type">void</span></code></em>);
</pre>
</div>
<div class="refsect1">
<a name="cogl-2.0-experimental-Quaternions-(Rotations).description"></a><h2>Description</h2>
<p>
Quaternions have become a standard form for representing 3D
rotations and have some nice properties when compared with other
representation such as (roll,pitch,yaw) Euler angles. They can be
used to interpolate between different rotations and they don't
suffer from a problem called "Gimbal lock" where two of the axis of
rotation may become aligned and you loose a degree of freedom.
(<a class="ulink" href="http://en.wikipedia.org/wiki/Gimbal_lock" target="_top">http://en.wikipedia.org/wiki/Gimbal_lock</a>).
</p>
</div>
<div class="refsect1">
<a name="cogl-2.0-experimental-Quaternions-(Rotations).details"></a><h2>Details</h2>
<div class="refsect2">
<a name="CoglQuaternion"></a><h3>CoglQuaternion</h3>
<pre class="programlisting">typedef struct {
  float w;

  float x;
  float y;
  float z;

  float padding0;
  float padding1;
  float padding2;
  float padding3;
} CoglQuaternion;
</pre>
<p>
A quaternion is comprised of a scalar component and a 3D vector
component. The scalar component is normally referred to as w and the
vector might either be referred to as v or a (for axis) or expanded
with the individual components: (x, y, z) A full quaternion would
then be written as <span style="color: red">&lt;pre&gt;[w (x, y, z)]&lt;/pre&gt;</span>.
</p>
<p>
Quaternions can be considered to represent an axis and angle
pair although sadly these numbers are buried somewhat under some
maths...
</p>
<p>
For the curious you can see here that a given axis (a) and angle (𝜃)
pair are represented in a quaternion as follows:
</p>
<div class="informalexample"><pre class="programlisting">
[w=cos(𝜃/2) ( x=sin(𝜃/2)*a.x, y=sin(𝜃/2)*a.y, z=sin(𝜃/2)*a.x )]
</pre></div>
<p>
</p>
<p>
Unit Quaternions:
When using Quaternions to represent spatial orientations for 3D
graphics it's always assumed you have a unit quaternion. The
magnitude of a quaternion is defined as:
</p>
<div class="informalexample"><pre class="programlisting">
sqrt (w² + x² + y² + z²)
</pre></div>
<p>
and a unit quaternion satisfies this equation:
</p>
<div class="informalexample"><pre class="programlisting">
w² + x² + y² + z² = 1
</pre></div>
<p>
</p>
<p>
Thankfully most of the time we don't actually have to worry about
the maths that goes on behind the scenes but if you are curious to
learn more here are some external references:
</p>
<p>
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><a class="ulink" href="http://mathworld.wolfram.com/Quaternion.html" target="_top">http://mathworld.wolfram.com/Quaternion.html</a></li>
<li class="listitem"><a class="ulink" href="http://www.gamedev.net/reference/articles/article1095.asp" target="_top">http://www.gamedev.net/reference/articles/article1095.asp</a></li>
<li class="listitem"><a class="ulink" href="http://www.cprogramming.com/tutorial/3d/quaternions.html" target="_top">http://www.cprogramming.com/tutorial/3d/quaternions.html</a></li>
<li class="listitem"><a class="ulink" href="http://www.isner.com/tutorials/quatSpells/quaternion_spells_12.htm" target="_top">http://www.isner.com/tutorials/quatSpells/quaternion_spells_12.htm</a></li>
<li class="listitem">
3D Maths Primer for Graphics and Game Development ISBN-10: 1556229119
</li>
<li class="listitem"><a class="ulink" href="http://www.cs.caltech.edu/courses/cs171/quatut.pdf" target="_top">http://www.cs.caltech.edu/courses/cs171/quatut.pdf</a></li>
<li class="listitem"><a class="ulink" href="http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q56" target="_top">http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q56</a></li>
</ul></div>
<p>
</p>
<p>
@w: based on the angle of rotation it is cos(𝜃/2)
@x: based on the angle of rotation and x component of the axis of
rotation it is sin(𝜃/2)*axis.x
@y: based on the angle of rotation and y component of the axis of
rotation it is sin(𝜃/2)*axis.y
@z: based on the angle of rotation and z component of the axis of
rotation it is sin(𝜃/2)*axis.z
</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-init-identity"></a><h3>cogl_quaternion_init_identity ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_init_identity       (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>);</pre>
<p>
Initializes the quaternion with the canonical quaternion identity
[1 (0, 0, 0)] which represents no rotation. Multiplying a
quaternion with this identity leaves the quaternion unchanged.
</p>
<p>
You might also want to consider using
<a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-get-static-identity-quaternion" title="cogl_get_static_identity_quaternion ()"><code class="function">cogl_get_static_identity_quaternion()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>quaternion</code></em> :</span></p></td>
<td>An uninitialized <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-init"></a><h3>cogl_quaternion_init ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_init                (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> angle</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> x</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> y</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> z</code></em>);</pre>
<p>
Initializes a quaternion that rotates <em class="parameter"><code>angle</code></em> degrees around the
axis vector (<em class="parameter"><code>x</code></em>, <em class="parameter"><code>y</code></em>, <em class="parameter"><code>z</code></em>). The axis vector does not need to be
normalized.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>quaternion</code></em> :</span></p></td>
<td>An uninitialized <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>angle</code></em> :</span></p></td>
<td>The angle you want to rotate around the given axis</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
<td>The x component of your axis vector about which you want to
rotate.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
<td>The y component of your axis vector about which you want to
rotate.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>z</code></em> :</span></p></td>
<td>The z component of your axis vector about which you want to
rotate.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A normalized, unit quaternion representing an orientation
rotated <em class="parameter"><code>angle</code></em> degrees around the axis vector (<em class="parameter"><code>x</code></em>, <em class="parameter"><code>y</code></em>, <em class="parameter"><code>z</code></em>)</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-init-from-angle-vector"></a><h3>cogl_quaternion_init_from_angle_vector ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_init_from_angle_vector
                                                        (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> angle</code></em>,
                                                         <em class="parameter"><code>const <span class="type">float</span> *axis3f</code></em>);</pre>
<p>
Initializes a quaternion that rotates <em class="parameter"><code>angle</code></em> degrees around the
given <em class="parameter"><code>axis</code></em> vector. The axis vector does not need to be
normalized.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>quaternion</code></em> :</span></p></td>
<td>An uninitialized <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>axis3f</code></em> :</span></p></td>
<td>your 3 component axis vector about which you want to rotate.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A normalized, unit quaternion representing an orientation
rotated <em class="parameter"><code>angle</code></em> degrees around the given <em class="parameter"><code>axis</code></em> vector.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-init-from-array"></a><h3>cogl_quaternion_init_from_array ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_init_from_array     (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code>const <span class="type">float</span> *array</code></em>);</pre>
<p>
Initializes a [w (x, y,z)] quaternion directly from an array of 4
floats: [w,x,y,z].
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>quaternion</code></em> :</span></p></td>
<td>A <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>array</code></em> :</span></p></td>
<td>An array of 4 floats (x,y,z),w</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-init-from-x-rotation"></a><h3>cogl_quaternion_init_from_x_rotation ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_init_from_x_rotation
                                                        (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> angle</code></em>);</pre>
<p>
XXX: check which direction this rotates
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>quaternion</code></em> :</span></p></td>
<td>An uninitialized <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>angle</code></em> :</span></p></td>
<td>The angle to rotate around the x axis</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-init-from-y-rotation"></a><h3>cogl_quaternion_init_from_y_rotation ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_init_from_y_rotation
                                                        (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> angle</code></em>);</pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>quaternion</code></em> :</span></p></td>
<td>An uninitialized <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>angle</code></em> :</span></p></td>
<td>The angle to rotate around the y axis</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-init-from-z-rotation"></a><h3>cogl_quaternion_init_from_z_rotation ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_init_from_z_rotation
                                                        (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> angle</code></em>);</pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>quaternion</code></em> :</span></p></td>
<td>An uninitialized <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>angle</code></em> :</span></p></td>
<td>The angle to rotate around the y axis</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-equal"></a><h3>cogl_quaternion_equal ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>            cogl_quaternion_equal               (<em class="parameter"><code><span class="type">gconstpointer</span> v1</code></em>,
                                                         <em class="parameter"><code><span class="type">gconstpointer</span> v2</code></em>);</pre>
<p>
Compares that all the components of quaternions <em class="parameter"><code>a</code></em> and <em class="parameter"><code>b</code></em> are
equal.
</p>
<p>
An epsilon value is not used to compare the float components, but
the == operator is at least used so that 0 and -0 are considered
equal.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>v1</code></em> :</span></p></td>
<td>A <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>v2</code></em> :</span></p></td>
<td>A <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<code class="literal">TRUE</code> if the quaternions are equal else <code class="literal">FALSE</code>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-copy"></a><h3>cogl_quaternion_copy ()</h3>
<pre class="programlisting"><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="returnvalue">CoglQuaternion</span></a> *    cogl_quaternion_copy                (<em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *src</code></em>);</pre>
<p>
Allocates a new <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> on the stack and initializes it with
the same values as <em class="parameter"><code>src</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src</code></em> :</span></p></td>
<td>A <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A newly allocated <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> which should be freed
using <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-free" title="cogl_quaternion_free ()"><code class="function">cogl_quaternion_free()</code></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-free"></a><h3>cogl_quaternion_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_free                (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>);</pre>
<p>
Frees a <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> that was previously allocated via
<a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-copy" title="cogl_quaternion_copy ()"><code class="function">cogl_quaternion_copy()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>quaternion</code></em> :</span></p></td>
<td>A <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-get-rotation-angle"></a><h3>cogl_quaternion_get_rotation_angle ()</h3>
<pre class="programlisting"><span class="returnvalue">float</span>               cogl_quaternion_get_rotation_angle  (<em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>);</pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>quaternion</code></em> :</span></p></td>
<td>A <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-get-rotation-axis"></a><h3>cogl_quaternion_get_rotation_axis ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_get_rotation_axis   (<em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> *vector3</code></em>);</pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>quaternion</code></em> :</span></p></td>
<td>A <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-normalize"></a><h3>cogl_quaternion_normalize ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_normalize           (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>);</pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>quaternion</code></em> :</span></p></td>
<td>A <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-dot-product"></a><h3>cogl_quaternion_dot_product ()</h3>
<pre class="programlisting"><span class="returnvalue">float</span>               cogl_quaternion_dot_product         (<em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *a</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *b</code></em>);</pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>a</code></em> :</span></p></td>
<td>A <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>b</code></em> :</span></p></td>
<td>A <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-invert"></a><h3>cogl_quaternion_invert ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_invert              (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>);</pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>quaternion</code></em> :</span></p></td>
<td>A <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-multiply"></a><h3>cogl_quaternion_multiply ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_multiply            (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *result</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *left</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *right</code></em>);</pre>
<p>
This combines the rotations of two quaternions into <em class="parameter"><code>result</code></em>. The
operation is not commutative so the order is important because AxB
!= BxA. Cogl follows the standard convention for quaternions here
so the rotations are applied <em class="parameter"><code>right</code></em> to <em class="parameter"><code>left</code></em>. This is similar to the
combining of matrices.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
<td>The destination <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>left</code></em> :</span></p></td>
<td>The second <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> rotation to apply</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>right</code></em> :</span></p></td>
<td>The first <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> rotation to apply</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-pow"></a><h3>cogl_quaternion_pow ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_pow                 (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *quaternion</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> exponent</code></em>);</pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>quaternion</code></em> :</span></p></td>
<td>A <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-slerp"></a><h3>cogl_quaternion_slerp ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_slerp               (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *result</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *a</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *b</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> t</code></em>);</pre>
<p>
Performs a spherical linear interpolation between two quaternions.
</p>
<p>
Noteable properties:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
commutative: No
</li>
<li class="listitem">
constant velocity: Yes
</li>
<li class="listitem">
torque minimal (travels along the surface of the 4-sphere): Yes
</li>
<li class="listitem">
more expensive than <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-nlerp" title="cogl_quaternion_nlerp ()"><code class="function">cogl_quaternion_nlerp()</code></a>
</li>
</ul></div>
<p>
</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-nlerp"></a><h3>cogl_quaternion_nlerp ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_nlerp               (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *result</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *a</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *b</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> t</code></em>);</pre>
<p>
Performs a normalized linear interpolation between two quaternions.
That is it does a linear interpolation of the quaternion components
and then normalizes the result. This will follow the shortest arc
between the two orientations (just like the <code class="function">slerp()</code> function) but
will not progress at a constant speed. Unlike <code class="function">slerp()</code> nlerp is
commutative which is useful if you are blending animations
together. (I.e. nlerp (tmp, a, b) followed by nlerp (result, tmp,
d) is the same as nlerp (tmp, a, d) followed by nlerp (result, tmp,
b)). Finally nlerp is cheaper than slerp so it can be a good choice
if you don't need the constant speed property of the <code class="function">slerp()</code> function.
</p>
<p>
Notable properties:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
commutative: Yes
</li>
<li class="listitem">
constant velocity: No
</li>
<li class="listitem">
torque minimal (travels along the surface of the 4-sphere): Yes
</li>
<li class="listitem">
faster than <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#cogl-quaternion-slerp" title="cogl_quaternion_slerp ()"><code class="function">cogl_quaternion_slerp()</code></a>
</li>
</ul></div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
<td>The destination <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>a</code></em> :</span></p></td>
<td>The first <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>b</code></em> :</span></p></td>
<td>The second <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>t</code></em> :</span></p></td>
<td>The factor in the range [0,1] used to interpolate between
quaterion <em class="parameter"><code>a</code></em> and <em class="parameter"><code>b</code></em>.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="cogl-quaternion-squad"></a><h3>cogl_quaternion_squad ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cogl_quaternion_squad               (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *result</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *prev</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *a</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *b</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="type">CoglQuaternion</span></a> *next</code></em>,
                                                         <em class="parameter"><code><span class="type">float</span> t</code></em>);</pre>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-get-static-identity-quaternion"></a><h3>cogl_get_static_identity_quaternion ()</h3>
<pre class="programlisting">const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="returnvalue">CoglQuaternion</span></a> * cogl_get_static_identity_quaternion
                                                        (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Returns a pointer to a singleton quaternion constant describing the
canonical identity [1 (0, 0, 0)] which represents no rotation.
</p>
<p>
If you multiply a quaternion with the identity quaternion you will
get back the same value as the original quaternion.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A pointer to an identity quaternion</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-get-static-zero-quaternion"></a><h3>cogl_get_static_zero_quaternion ()</h3>
<pre class="programlisting">const <a class="link" href="cogl-2.0-experimental-Quaternions-(Rotations).html#CoglQuaternion" title="CoglQuaternion"><span class="returnvalue">CoglQuaternion</span></a> * cogl_get_static_zero_quaternion  (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a pointer to a singleton quaternion constant describing a
rotation of 180 degrees around a degenerate axis:
[0 (0, 0, 0)]</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.0</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>