source: other-projects/playing-in-the-street/summer-2013/trunk/Playing-in-the-Street-WPF/Content/Web/mrdoob-three.js-4862f5f/docs/api/math/Quaternion.html@ 28897

Last change on this file since 28897 was 28897, checked in by davidb, 10 years ago

GUI front-end to server base plus web page content

File size: 4.8 KB
Line 
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta charset="utf-8" />
5 <script src="../../list.js"></script>
6 <script src="../../page.js"></script>
7 <link type="text/css" rel="stylesheet" href="../../page.css" />
8 </head>
9 <body>
10 <h1>[name]</h1>
11
12 <div class="desc">Implementation of a <a href="http://en.wikipedia.org/wiki/Quaternion">quaternion</a>. This is used for rotating things without encountering the dreaded <a href="http://en.wikipedia.org/wiki/Gimbal_lock">gimbal lock</a> issue, amongst other advantages.</div>
13
14
15 <h2>Example</h2>
16
17 <code>var quaternion = new THREE.Quaternion();
18 quaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 );
19
20 var vector = new THREE.Vector3( 1, 0, 0 );
21 vector.applyQuaternion( quaternion );
22 </code>
23
24
25 <h2>Constructor</h2>
26
27
28 <h3>[name]( [page:Float x], [page:Float y], [page:Float z], [page:Float w] )</h3>
29 <div>
30 x - x coordinate<br />
31 y - y coordinate<br />
32 z - z coordinate<br />
33 w - w coordinate
34 </div>
35
36
37 <h2>Properties</h2>
38
39 <h3>.[page:Float x]</h3>
40
41 <h3>.[page:Float y]</h3>
42
43 <h3>.[page:Float z]</h3>
44
45 <h3>.[page:Float w]</h3>
46
47
48 <h2>Methods</h2>
49
50 <h3>.set( [page:Float x], [page:Float y], [page:Float z], [page:Float w] ) [page:Quaternion]</h3>
51 <div>
52 Sets values of this quaternion.
53 </div>
54
55 <h3>.copy( [page:Quaternion q] ) [page:Quaternion]</h3>
56 <div>
57 Copies values of *q* to this quaternion.
58 </div>
59
60 <h3>.setFromEuler( [page:Vector3 vector] ) [page:Quaternion]</h3>
61 <div>
62 Sets this quaternion from rotation specified by Euler angles.
63 </div>
64
65 <h3>.setFromAxisAngle( [page:Vector3 axis], [page:Float angle] ) [page:Quaternion]</h3>
66 <div>
67 Sets this quaternion from rotation specified by axis and angle.<br />
68 Adapted from [link:http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm].<br />
69 *Axis* have to be normalized, *angle* is in radians.
70 </div>
71
72 <h3>.setFromRotationMatrix( [page:Matrix4 m] ) [page:Quaternion]</h3>
73 <div>
74 Sets this quaternion from rotation component of *m*.
75 Adapted from [link:http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm].
76 </div>
77
78 <h3>.inverse() [page:Quaternion]</h3>
79 <div>
80 Inverts this quaternion.
81 </div>
82
83 <h3>.length() [page:Float]</h3>
84 <div>
85 Computes length of this quaternion.
86 </div>
87
88 <h3>.normalize() [page:Quaternion]</h3>
89 <div>
90 Normalizes this quaternion.
91 </div>
92
93 <h3>.multiply( [page:Quaternion b] ) [page:Quaternion]</h3>
94 <div>
95 Multiplies this quaternion by *b*.
96 </div>
97
98 <h3>.multiplyQuaternions( [page:Quaternion a], [page:Quaternion b] ) [page:Quaternion]</h3>
99 <div>
100 Sets this quaternion to *a x b*<br />
101 Adapted from [link:http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm].
102 </div>
103
104 <h3>.multiplyVector3( [page:Vector3 vector], [page:Vector3 dest] ) [page:Quaternion]</h3>
105 <div>
106 Rotates *vector* by this quaternion into *dest*.<br />
107 If *dest* is not specified, result goes to *vec*.
108 </div>
109
110 <h3>.clone() [page:Quaternion]</h3>
111 <div>
112 Clones this quaternion.
113 </div>
114
115
116 <h2>Static methods</h2>
117
118 <h3>.slerp( [page:Quaternion qa], [page:Quaternion qb], [page:Quaternion qm], [page:Float t] ) [page:Quaternion]</h3>
119 <div>
120 Adapted from [link:http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/].
121 </div>
122
123
124 <h3>.slerp([page:Quaternion qb], [page:float t]) [page:Quaternion]</h3>
125 <div>
126 qb -- Target quaternion rotation.<br />
127 t -- Normalized [0..1] interpolation factor.
128 </div>
129 <div>
130 Handles the spherical linear interpolation between this quaternion's configuration
131 and that of *qb*. *t* represents how close to the current (0) or target (1) rotation the
132 result should be.
133 </div>
134
135 <h3>.toArray() [page: Array]</h3>
136 <div>
137 Returns the numerical elements of this quaternion in an array of format (x, y, z, w).
138 </div>
139
140 <h3>.equals([page:Quaternion v]) [page:Boolean]</h3>
141 <div>
142 v -- Quaternion that this quaternion will be compared to.
143 </div>
144 <div>
145 Compares each component of *v* to each component of this quaternion to determine if they
146 represent the same rotation.
147 </div>
148
149 <h3>.lengthSq() [page:Float]</h3>
150 <div>
151 Calculates the squared length of the quaternion.
152 </div>
153
154 <h3>.fromArray([page:Array array]) [page:Quaternion]</h3>
155 <div>
156 array -- Array of format (x, y, z, w) used to construct the quaternion.
157 </div>
158 <div>
159 Sets this quaternion's component values from an array.
160 </div>
161
162 <h3>.conjugate() [page:Quaternion]</h3>
163 <div>
164 Returns the rotational conjugate of this quaternion. The conjugate of a quaternion
165 represents the same rotation in the opposite direction about the rotational axis.
166 </div>
167
168 <h2>Source</h2>
169
170 [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
171 </body>
172</html>
Note: See TracBrowser for help on using the repository browser.