source: other-projects/playing-in-the-street/summer-2013/trunk/Playing-in-the-Street-WPF/Content/Web/mrdoob-three.js-4862f5f/docs/api/math/Matrix4.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: 7.7 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">A 4x4 Matrix.</div>
13
14
15 <h2>Example</h2>
16
17 <code>// Simple rig for rotating around 3 axes
18
19 var m = new THREE.Matrix4();
20
21 var m1 = new THREE.Matrix4();
22 var m2 = new THREE.Matrix4();
23 var m3 = new THREE.Matrix4();
24
25 var alpha = 0;
26 var beta = Math.PI;
27 var gamma = Math.PI/2;
28
29 m1.makeRotationX( alpha );
30 m2.makeRotationY( beta );
31 m3.makeRotationZ( gamma );
32
33 m.multiplyMatrices( m1, m2 );
34 m.multiply( m3 );
35 </code>
36
37
38 <h2>Constructor</h2>
39
40
41 <h3>[name]( [page:Float n11], [page:Float n12], [page:Float n13], [page:Float n14], [page:Float n21], [page:Float n22], [page:Float n23], [page:Float n24], [page:Float n31], [page:Float n32], [page:Float n33], [page:Float n34], [page:Float n41], [page:Float n42], [page:Float n43], [page:Float n44] )</h3>
42
43 <div>
44 Initialises the matrix with the supplied row-major values n11..n44, or just creates an identity matrix if no values are passed.
45 </div>
46
47 <h2>Properties</h2>
48
49 <h3>.[page:Float32Array elements]</h3>
50 <div>A column-major list of matrix values.</div>
51
52 <h2>Methods</h2>
53
54 <h3>.set( [page:Float n11], [page:Float n12], [page:Float n13], [page:Float n14], [page:Float n21], [page:Float n22], [page:Float n23], [page:Float n24], [page:Float n31], [page:Float n32], [page:Float n33], [page:Float n34], [page:Float n41], [page:Float n42], [page:Float n43], [page:Float n44] ) [page:Matrix4 this]</h3>
55 <div>
56 Sets all fields of this matrix to the supplied row-major values n11..n44.
57 </div>
58
59 <h3>.identity() [page:Matrix4 this]</h3>
60 <div>
61 Resets this matrix to identity.
62 </div>
63
64 <h3>.copy( [page:Matrix4 m] ) [page:Matrix4 this]</h3>
65 <div>
66 Copies a matrix *m* into this matrix.
67 </div>
68
69 <h3>.copyPosition( [page:Matrix4 m] ) [page:Matrix4 this]</h3>
70 <div>
71 Copies the translation component of the supplied matrix *m* into this matrix translation component.
72 </div>
73
74 <h3>.extractRotation( [page:Matrix4 m] ) [page:Matrix4 this]</h3>
75 <div>
76 Extracts the rotation of the supplied matrix *m* into this matrix rotation component.
77 </div>
78
79 <h3>.lookAt( [page:Vector3 eye], [page:Vector3 center], [page:Vector3 up], ) [page:Matrix4 this]</h3>
80 <div>
81 Constructs a rotation matrix, looking from *eye* towards *center* with defined *up* vector.
82 </div>
83
84 <h3>.multiply( [page:Matrix4 m] ) [page:Matrix4 this]</h3>
85 <div>
86 Multiplies this matrix by *m*.
87 </div>
88
89 <h3>.multiplyMatrices( [page:Matrix4 a], [page:Matrix4 b] ) [page:Matrix4 this]</h3>
90 <div>
91 Sets this matrix to *a x b*.
92 </div>
93
94 <h3>.multiplyToArray( [page:Matrix4 a], [page:Matrix4 b], [page:Array r] ) [page:Matrix4 this]</h3>
95 <div>
96 Sets this matrix to *a x b* and stores the result into the flat array *r*.<br />
97 *r* can be either a regular Array or a TypedArray.
98 </div>
99
100 <h3>.multiplyScalar( [page:Float s] ) [page:Matrix4 this]</h3>
101 <div>
102 Multiplies this matrix by *s*.
103 </div>
104
105 <h3>.determinant() [page:Float]</h3>
106 <div>
107 Computes determinant of this matrix.<br />
108 Based on [link:http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm]
109 </div>
110
111 <h3>.transpose() [page:Matrix4 this]</h3>
112 <div>
113 Transposes this matrix.
114 </div>
115
116 <h3>.flattenToArray( [page:Array flat] ) [page:Array]</h3>
117 <div>
118 Flattens this matrix into supplied *flat* array.
119 </div>
120
121 <h3>.flattenToArrayOffset( [page:Array flat], [page:Integer offset] ) [page:Array]</h3>
122 <div>
123 Flattens this matrix into supplied *flat* array starting from *offset* position in the array.
124 </div>
125
126 <h3>.setPosition( [page:Vector3 v] ) [page:Matrix4 this]</h3>
127 <div>
128 Sets the position component for this matrix from vector *v*.
129 </div>
130
131 <h3>.getInverse( [page:Matrix4 m] ) [page:Matrix4 this]</h3>
132 <div>
133 Sets this matrix to the inverse of matrix *m*.<br />
134 Based on [link:http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm].
135 </div>
136
137 <h3>.makeRotationFromEuler( [page:Vector3 v], [page:String order] ) [page:Matrix4 this]</h3>
138 <div>
139 v — Rotation vector.
140 order — The order of rotations. Eg. "XYZ".
141 </div>
142 <div>
143 Sets the rotation submatrix of this matrix to the rotation specified by Euler angles, the rest of the matrix is identity.<br />
144 Default order is *"XYZ"*.
145 </div>
146
147 <h3>.makeRotationFromQuaternion( [page:Quaternion q] ) [page:Matrix4 this]</h3>
148 <div>
149 Sets the rotation submatrix of this matrix to the rotation specified by *q*. The rest of the matrix is identity.
150 </div>
151
152 <h3>.scale( [page:Vector3 v] ) [page:Matrix4 this]</h3>
153 <div>
154 Multiplies the columns of this matrix by vector *v*.
155 </div>
156
157 <h3>.compose( [page:Vector3 translation], [page:Quaternion quaternion], [page:Vector3 scale] ) [page:Matrix4 this]</h3>
158 <div>
159 Sets this matrix to the transformation composed of *translation*, *quaternion* and *scale*.
160 </div>
161
162 <h3>.decompose( [page:Vector3 translation], [page:Quaternion quaternion], [page:Vector3 scale] ) [page:Array]</h3>
163 <div>
164 Decomposes this matrix into the *translation*, *quaternion* and *scale* components.<br />
165 If parameters are not passed, new instances will be created.
166 </div>
167
168 <h3>.makeTranslation( [page:Float x], [page:Float y], [page:Float z] ) [page:Matrix4 this]</h3>
169 <div>
170 Sets this matrix as translation transform.
171 </div>
172
173 <h3>.makeRotationX( [page:Float theta] ) [page:Matrix4 this]</h3>
174 <div>
175 theta — Rotation angle in radians.
176 </div>
177 <div>
178 Sets this matrix as rotation transform around x axis by *theta* radians.
179 </div>
180
181 <h3>.makeRotationY( [page:Float theta] ) [page:Matrix4 this]</h3>
182 <div>
183 theta — Rotation angle in radians.
184 </div>
185 <div>
186 Sets this matrix as rotation transform around y axis by *theta* radians.
187 </div>
188
189 <h3>.makeRotationZ( [page:Float theta] ) [page:Matrix4 this]</h3>
190 <div>
191 theta — Rotation angle in radians.
192 </div>
193 <div>
194 Sets this matrix as rotation transform around z axis by *theta* radians.
195 </div>
196
197 <h3>.makeRotationAxis( [page:Vector3 axis], [page:Float theta] ) [page:Matrix4 this]</h3>
198 <div>
199 axis — Rotation axis, should be normalized.
200 theta — Rotation angle in radians.
201 </div>
202 <div>
203 Sets this matrix as rotation transform around *axis* by *angle* radians.<br />
204 Based on [link:http://www.gamedev.net/reference/articles/article1199.asp].
205 </div>
206
207 <h3>.makeScale( [page:Float x], [page:Float y], [page:Float z] ) [page:Matrix4 this]</h3>
208 <div>
209 Sets this matrix as scale transform.
210 </div>
211
212 <h3>.makeFrustum( [page:Float left], [page:Float right], [page:Float bottom], [page:Float top], [page:Float near], [page:Float far] ) [page:Matrix4 this]</h3>
213 <div>
214 Creates a [page:Frustum frustum] matrix.
215 </div>
216
217 <h3>.makePerspective( [page:Float fov], [page:Float aspect], [page:Float near], [page:Float far] ) [page:Matrix4 this]</h3>
218 <div>
219 Creates a perspective projection matrix.
220 </div>
221
222 <h3>.makeOrthographic( [page:Float left], [page:Float right], [page:Float bottom], [page:Float top], [page:Float near], [page:Float far] ) [page:Matrix4 this]</h3>
223 <div>
224 Creates an orthographic projection matrix.
225 </div>
226
227 <h3>.clone() [page:Matrix4]</h3>
228 <div>
229 Clones this matrix.
230 </div>
231
232 <h3>.multiplyVector3Array([page:Array a]) [page:Array]</h3>
233 <div>
234 array -- An array in the form [vector1x, vector1y, vector1z, vector2x, vector2y, vector2z, ...]
235 </div>
236 <div>
237 Multiply (apply) this matrix against every vector3 in the array.
238 </div>
239
240 <h3>.getMaxScaleOnAxis() [page:Float]</h3>
241 <div>
242 Gets the max scale value of the 3 axes.
243 </div>
244
245 <h2>Source</h2>
246
247 [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
248 </body>
249</html>
Note: See TracBrowser for help on using the repository browser.