forked from mrdoob/three.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuaternion.html
121 lines (86 loc) · 2.88 KB
/
Quaternion.html
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
<h1>[name]</h1>
<div class="desc">Implementation of a quaternion</div>
<h2>Example</h2>
<code>var q = new THREE.Quaternion();
q.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 );
var v = new THREE.Vector3( 1, 0, 0 );
q.multiplyVector3( v );
</code>
<h2>Constructor</h2>
<h3>[name]( [page:Float x], [page:Float y], [page:Float z], [page:Float w] )</h3>
<div>
x - x coordinate<br />
y - y coordinate<br />
z - z coordinate<br />
w - w coordinate
</div>
<h2>Properties</h2>
<h3>.[page:Float x]</h3>
<h3>.[page:Float y]</h3>
<h3>.[page:Float z]</h3>
<h3>.[page:Float w]</h3>
<h2>Methods</h2>
<h3>.set( [page:Float x], [page:Float y], [page:Float z], [page:Float w] ) [page:Quaternion]</h3>
<div>
Sets values of this quaternion.
</div>
<h3>.copy( [page:Quaternion q] ) [page:Quaternion]</h3>
<div>
Copies values of *q* to this quaternion.
</div>
<h3>.setFromEuler( [page:Vector3 vector] ) [page:Quaternion]</h3>
<div>
Sets this quaternion from rotation specified by Euler angles.
</div>
<h3>.setFromAxisAngle( [page:Vector3 axis], [page:Float angle] ) [page:Quaternion]</h3>
<div>
Sets this quaternion from rotation specified by axis and angle.<br />
Adapted from [link:http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm].<br />
*Axis* have to be normalized, *angle* is in radians.
</div>
<h3>.setFromRotationMatrix( [page:Matrix4 m] ) [page:Quaternion]</h3>
<div>
Sets this quaternion from rotation component of *m*.
Adapted from [link:http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm].
</div>
<h3>.calculateW() [page:Quaternion]</h3>
<div>
Calculates *w* component of this quaternion.
</div>
<h3>.inverse() [page:Quaternion]</h3>
<div>
Inverts this quaternion.
</div>
<h3>.length() [page:Float]</h3>
<div>
Computes length of this quaternion.
</div>
<h3>.normalize() [page:Quaternion]</h3>
<div>
Normalizes this quaternion.
</div>
<h3>.multiply( [page:Quaternion a], [page:Quaternion b] ) [page:Quaternion]</h3>
<div>
Sets this quaternion to *a x b*<br />
Adapted from [link:http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm].
</div>
<h3>.multiplySelf( [page:Quaternion b] ) [page:Quaternion]</h3>
<div>
Multiplies this quaternion by *b*.
</div>
<h3>.multiplyVector3( [page:Vector3 vector], [page:Vector3 dest] ) [page:Quaternion]</h3>
<div>
Rotates *vector* by this quaternion into *dest*.<br />
If *dest* is not specified, result goes to *vec*.
</div>
<h3>.clone() [page:Quaternion]</h3>
<div>
Clones this quaternion.
</div>
<h2>Static methods</h2>
<h3>.slerp( [page:Quaternion qa], [page:Quaternion qb], [page:Quaternion qm], [page:Float t] ) [page:Quaternion]</h3>
<div>
Adapted from [link:http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/].
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]