1
0

Matrix4.html 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Matrix4 - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">Matrix4</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>Represents a 4x4 matrix.</p>
  16. <p>The most common use of a 4x4 matrix in 3D computer graphics is as a transformation matrix.
  17. For an introduction to transformation matrices as used in WebGL, check out <a href="https://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices" target="_blank" rel="noopener">this tutorial</a></p>
  18. <p>This allows a 3D vector representing a point in 3D space to undergo
  19. transformations such as translation, rotation, shear, scale, reflection,
  20. orthogonal or perspective projection and so on, by being multiplied by the
  21. matrix. This is known as <code>applying</code> the matrix to the vector.</p>
  22. <p>A Note on Row-Major and Column-Major Ordering:</p>
  23. <p>The constructor and <a href="Matrix3.html#set">Matrix3#set</a> method take arguments in
  24. <a href="https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order" target="_blank" rel="noopener">row-major</a>
  25. order, while internally they are stored in the <a href="Matrix3.html#elements">Matrix3#elements</a> array in column-major order.
  26. This means that calling:</p>
  27. <p>will result in the elements array containing:</p>
  28. <pre><code class="language-js">m.elements = [ 11, 21, 31, 41,
  29. 12, 22, 32, 42,
  30. 13, 23, 33, 43,
  31. 14, 24, 34, 44 ];
  32. </code></pre>
  33. <p>and internally all calculations are performed using column-major ordering.
  34. However, as the actual ordering makes no difference mathematically and
  35. most people are used to thinking about matrices in row-major order, the
  36. three.js documentation shows matrices in row-major order. Just bear in
  37. mind that if you are reading the source code, you'll have to take the
  38. transpose of any matrices outlined here to make sense of the calculations.</p></div>
  39. <h2>Code Example</h2>
  40. <div translate="no"><pre><code class="language-js">const m = new THREE.Matrix4();
  41. m.set( 11, 12, 13, 14,
  42. 21, 22, 23, 24,
  43. 31, 32, 33, 34,
  44. 41, 42, 43, 44 );
  45. </code></pre></div>
  46. </header>
  47. <article>
  48. <div class="container-overview">
  49. <h2>Constructor</h2>
  50. <h3 class="name name-method" id="Matrix4" translate="no">new <a href="#Matrix4">Matrix4</a><span class="signature">( n11 : <span class="param-type">number</span>, n12 : <span class="param-type">number</span>, n13 : <span class="param-type">number</span>, n14 : <span class="param-type">number</span>, n21 : <span class="param-type">number</span>, n22 : <span class="param-type">number</span>, n23 : <span class="param-type">number</span>, n24 : <span class="param-type">number</span>, n31 : <span class="param-type">number</span>, n32 : <span class="param-type">number</span>, n33 : <span class="param-type">number</span>, n34 : <span class="param-type">number</span>, n41 : <span class="param-type">number</span>, n42 : <span class="param-type">number</span>, n43 : <span class="param-type">number</span>, n44 : <span class="param-type">number</span> )</span> </h3>
  51. <div class="method">
  52. <div class="description">
  53. <p>Constructs a new 4x4 matrix. The arguments are supposed to be
  54. in row-major order. If no arguments are provided, the constructor
  55. initializes the matrix as an identity matrix.</p>
  56. </div>
  57. <table class="params">
  58. <tbody>
  59. <tr>
  60. <td class="name">
  61. <strong>n11</strong>
  62. </td>
  63. <td class="description last">
  64. <p>1-1 matrix element.</p>
  65. </td>
  66. </tr>
  67. <tr>
  68. <td class="name">
  69. <strong>n12</strong>
  70. </td>
  71. <td class="description last">
  72. <p>1-2 matrix element.</p>
  73. </td>
  74. </tr>
  75. <tr>
  76. <td class="name">
  77. <strong>n13</strong>
  78. </td>
  79. <td class="description last">
  80. <p>1-3 matrix element.</p>
  81. </td>
  82. </tr>
  83. <tr>
  84. <td class="name">
  85. <strong>n14</strong>
  86. </td>
  87. <td class="description last">
  88. <p>1-4 matrix element.</p>
  89. </td>
  90. </tr>
  91. <tr>
  92. <td class="name">
  93. <strong>n21</strong>
  94. </td>
  95. <td class="description last">
  96. <p>2-1 matrix element.</p>
  97. </td>
  98. </tr>
  99. <tr>
  100. <td class="name">
  101. <strong>n22</strong>
  102. </td>
  103. <td class="description last">
  104. <p>2-2 matrix element.</p>
  105. </td>
  106. </tr>
  107. <tr>
  108. <td class="name">
  109. <strong>n23</strong>
  110. </td>
  111. <td class="description last">
  112. <p>2-3 matrix element.</p>
  113. </td>
  114. </tr>
  115. <tr>
  116. <td class="name">
  117. <strong>n24</strong>
  118. </td>
  119. <td class="description last">
  120. <p>2-4 matrix element.</p>
  121. </td>
  122. </tr>
  123. <tr>
  124. <td class="name">
  125. <strong>n31</strong>
  126. </td>
  127. <td class="description last">
  128. <p>3-1 matrix element.</p>
  129. </td>
  130. </tr>
  131. <tr>
  132. <td class="name">
  133. <strong>n32</strong>
  134. </td>
  135. <td class="description last">
  136. <p>3-2 matrix element.</p>
  137. </td>
  138. </tr>
  139. <tr>
  140. <td class="name">
  141. <strong>n33</strong>
  142. </td>
  143. <td class="description last">
  144. <p>3-3 matrix element.</p>
  145. </td>
  146. </tr>
  147. <tr>
  148. <td class="name">
  149. <strong>n34</strong>
  150. </td>
  151. <td class="description last">
  152. <p>3-4 matrix element.</p>
  153. </td>
  154. </tr>
  155. <tr>
  156. <td class="name">
  157. <strong>n41</strong>
  158. </td>
  159. <td class="description last">
  160. <p>4-1 matrix element.</p>
  161. </td>
  162. </tr>
  163. <tr>
  164. <td class="name">
  165. <strong>n42</strong>
  166. </td>
  167. <td class="description last">
  168. <p>4-2 matrix element.</p>
  169. </td>
  170. </tr>
  171. <tr>
  172. <td class="name">
  173. <strong>n43</strong>
  174. </td>
  175. <td class="description last">
  176. <p>4-3 matrix element.</p>
  177. </td>
  178. </tr>
  179. <tr>
  180. <td class="name">
  181. <strong>n44</strong>
  182. </td>
  183. <td class="description last">
  184. <p>4-4 matrix element.</p>
  185. </td>
  186. </tr>
  187. </tbody>
  188. </table>
  189. </div>
  190. </div>
  191. <h2 class="subsection-title">Properties</h2>
  192. <div class="member">
  193. <h3 class="name" id="elements" translate="no">.<a href="#elements">elements</a><span class="type-signature"> : Array.&lt;number></span> </h3>
  194. <div class="description">
  195. <p>A column-major list of matrix values.</p>
  196. </div>
  197. </div>
  198. <div class="member">
  199. <h3 class="name" id="isMatrix4" translate="no">.<a href="#isMatrix4">isMatrix4</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  200. <div class="description">
  201. <p>This flag can be used for type testing.</p>
  202. <p>Default is <code>true</code>.</p>
  203. </div>
  204. </div>
  205. <h2 class="subsection-title">Methods</h2>
  206. <h3 class="name name-method" id="clone" translate="no">.<a href="#clone">clone</a><span class="signature">()</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  207. <div class="method">
  208. <div class="description">
  209. <p>Returns a matrix with copied values from this instance.</p>
  210. </div>
  211. <dl class="details">
  212. <dt class="tag-returns"><strong>Returns:</strong> A clone of this instance.</dt>
  213. </dl>
  214. </div>
  215. <h3 class="name name-method" id="compose" translate="no">.<a href="#compose">compose</a><span class="signature">( position : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, quaternion : <span class="param-type"><a href="Quaternion.html">Quaternion</a></span>, scale : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  216. <div class="method">
  217. <div class="description">
  218. <p>Sets this matrix to the transformation composed of the given position,
  219. rotation (Quaternion) and scale.</p>
  220. </div>
  221. <table class="params">
  222. <tbody>
  223. <tr>
  224. <td class="name">
  225. <strong>position</strong>
  226. </td>
  227. <td class="description last">
  228. <p>The position vector.</p>
  229. </td>
  230. </tr>
  231. <tr>
  232. <td class="name">
  233. <strong>quaternion</strong>
  234. </td>
  235. <td class="description last">
  236. <p>The rotation as a Quaternion.</p>
  237. </td>
  238. </tr>
  239. <tr>
  240. <td class="name">
  241. <strong>scale</strong>
  242. </td>
  243. <td class="description last">
  244. <p>The scale vector.</p>
  245. </td>
  246. </tr>
  247. </tbody>
  248. </table>
  249. <dl class="details">
  250. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  251. </dl>
  252. </div>
  253. <h3 class="name name-method" id="copy" translate="no">.<a href="#copy">copy</a><span class="signature">( m : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  254. <div class="method">
  255. <div class="description">
  256. <p>Copies the values of the given matrix to this instance.</p>
  257. </div>
  258. <table class="params">
  259. <tbody>
  260. <tr>
  261. <td class="name">
  262. <strong>m</strong>
  263. </td>
  264. <td class="description last">
  265. <p>The matrix to copy.</p>
  266. </td>
  267. </tr>
  268. </tbody>
  269. </table>
  270. <dl class="details">
  271. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  272. </dl>
  273. </div>
  274. <h3 class="name name-method" id="copyPosition" translate="no">.<a href="#copyPosition">copyPosition</a><span class="signature">( m : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  275. <div class="method">
  276. <div class="description">
  277. <p>Copies the translation component of the given matrix
  278. into this matrix's translation component.</p>
  279. </div>
  280. <table class="params">
  281. <tbody>
  282. <tr>
  283. <td class="name">
  284. <strong>m</strong>
  285. </td>
  286. <td class="description last">
  287. <p>The matrix to copy the translation component.</p>
  288. </td>
  289. </tr>
  290. </tbody>
  291. </table>
  292. <dl class="details">
  293. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  294. </dl>
  295. </div>
  296. <h3 class="name name-method" id="decompose" translate="no">.<a href="#decompose">decompose</a><span class="signature">( position : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, quaternion : <span class="param-type"><a href="Quaternion.html">Quaternion</a></span>, scale : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  297. <div class="method">
  298. <div class="description">
  299. <p>Decomposes this matrix into its position, rotation and scale components
  300. and provides the result in the given objects.</p>
  301. <p>Note: Not all matrices are decomposable in this way. For example, if an
  302. object has a non-uniformly scaled parent, then the object's world matrix
  303. may not be decomposable, and this method may not be appropriate.</p>
  304. </div>
  305. <table class="params">
  306. <tbody>
  307. <tr>
  308. <td class="name">
  309. <strong>position</strong>
  310. </td>
  311. <td class="description last">
  312. <p>The position vector.</p>
  313. </td>
  314. </tr>
  315. <tr>
  316. <td class="name">
  317. <strong>quaternion</strong>
  318. </td>
  319. <td class="description last">
  320. <p>The rotation as a Quaternion.</p>
  321. </td>
  322. </tr>
  323. <tr>
  324. <td class="name">
  325. <strong>scale</strong>
  326. </td>
  327. <td class="description last">
  328. <p>The scale vector.</p>
  329. </td>
  330. </tr>
  331. </tbody>
  332. </table>
  333. <dl class="details">
  334. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  335. </dl>
  336. </div>
  337. <h3 class="name name-method" id="determinant" translate="no">.<a href="#determinant">determinant</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
  338. <div class="method">
  339. <div class="description">
  340. <p>Computes and returns the determinant of this matrix.</p>
  341. <p>Based on the method outlined <a href="http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.html" target="_blank" rel="noopener">here</a>.</p>
  342. </div>
  343. <dl class="details">
  344. <dt class="tag-returns"><strong>Returns:</strong> The determinant.</dt>
  345. </dl>
  346. </div>
  347. <h3 class="name name-method" id="equals" translate="no">.<a href="#equals">equals</a><span class="signature">( matrix : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  348. <div class="method">
  349. <div class="description">
  350. <p>Returns <code>true</code> if this matrix is equal with the given one.</p>
  351. </div>
  352. <table class="params">
  353. <tbody>
  354. <tr>
  355. <td class="name">
  356. <strong>matrix</strong>
  357. </td>
  358. <td class="description last">
  359. <p>The matrix to test for equality.</p>
  360. </td>
  361. </tr>
  362. </tbody>
  363. </table>
  364. <dl class="details">
  365. <dt class="tag-returns"><strong>Returns:</strong> Whether this matrix is equal with the given one.</dt>
  366. </dl>
  367. </div>
  368. <h3 class="name name-method" id="extractBasis" translate="no">.<a href="#extractBasis">extractBasis</a><span class="signature">( xAxis : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, yAxis : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, zAxis : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  369. <div class="method">
  370. <div class="description">
  371. <p>Extracts the basis of this matrix into the three axis vectors provided.</p>
  372. </div>
  373. <table class="params">
  374. <tbody>
  375. <tr>
  376. <td class="name">
  377. <strong>xAxis</strong>
  378. </td>
  379. <td class="description last">
  380. <p>The basis's x axis.</p>
  381. </td>
  382. </tr>
  383. <tr>
  384. <td class="name">
  385. <strong>yAxis</strong>
  386. </td>
  387. <td class="description last">
  388. <p>The basis's y axis.</p>
  389. </td>
  390. </tr>
  391. <tr>
  392. <td class="name">
  393. <strong>zAxis</strong>
  394. </td>
  395. <td class="description last">
  396. <p>The basis's z axis.</p>
  397. </td>
  398. </tr>
  399. </tbody>
  400. </table>
  401. <dl class="details">
  402. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  403. </dl>
  404. </div>
  405. <h3 class="name name-method" id="extractRotation" translate="no">.<a href="#extractRotation">extractRotation</a><span class="signature">( m : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  406. <div class="method">
  407. <div class="description">
  408. <p>Extracts the rotation component of the given matrix
  409. into this matrix's rotation component.</p>
  410. <p>Note: This method does not support reflection matrices.</p>
  411. </div>
  412. <table class="params">
  413. <tbody>
  414. <tr>
  415. <td class="name">
  416. <strong>m</strong>
  417. </td>
  418. <td class="description last">
  419. <p>The matrix.</p>
  420. </td>
  421. </tr>
  422. </tbody>
  423. </table>
  424. <dl class="details">
  425. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  426. </dl>
  427. </div>
  428. <h3 class="name name-method" id="fromArray" translate="no">.<a href="#fromArray">fromArray</a><span class="signature">( array : <span class="param-type">Array.&lt;number></span>, offset : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  429. <div class="method">
  430. <div class="description">
  431. <p>Sets the elements of the matrix from the given array.</p>
  432. </div>
  433. <table class="params">
  434. <tbody>
  435. <tr>
  436. <td class="name">
  437. <strong>array</strong>
  438. </td>
  439. <td class="description last">
  440. <p>The matrix elements in column-major order.</p>
  441. </td>
  442. </tr>
  443. <tr>
  444. <td class="name">
  445. <strong>offset</strong>
  446. </td>
  447. <td class="description last">
  448. <p>Index of the first element in the array.</p>
  449. <p>Default is <code>0</code>.</p>
  450. </td>
  451. </tr>
  452. </tbody>
  453. </table>
  454. <dl class="details">
  455. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  456. </dl>
  457. </div>
  458. <h3 class="name name-method" id="getMaxScaleOnAxis" translate="no">.<a href="#getMaxScaleOnAxis">getMaxScaleOnAxis</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
  459. <div class="method">
  460. <div class="description">
  461. <p>Gets the maximum scale value of the three axes.</p>
  462. </div>
  463. <dl class="details">
  464. <dt class="tag-returns"><strong>Returns:</strong> The maximum scale.</dt>
  465. </dl>
  466. </div>
  467. <h3 class="name name-method" id="identity" translate="no">.<a href="#identity">identity</a><span class="signature">()</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  468. <div class="method">
  469. <div class="description">
  470. <p>Sets this matrix to the 4x4 identity matrix.</p>
  471. </div>
  472. <dl class="details">
  473. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  474. </dl>
  475. </div>
  476. <h3 class="name name-method" id="invert" translate="no">.<a href="#invert">invert</a><span class="signature">()</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  477. <div class="method">
  478. <div class="description">
  479. <p>Inverts this matrix, using the <a href="https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution" target="_blank" rel="noopener">analytic method</a>.
  480. You can not invert with a determinant of zero. If you attempt this, the method produces
  481. a zero matrix instead.</p>
  482. </div>
  483. <dl class="details">
  484. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  485. </dl>
  486. </div>
  487. <h3 class="name name-method" id="lookAt" translate="no">.<a href="#lookAt">lookAt</a><span class="signature">( eye : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, target : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, up : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  488. <div class="method">
  489. <div class="description">
  490. <p>Sets the rotation component of the transformation matrix, looking from <code>eye</code> towards
  491. <code>target</code>, and oriented by the up-direction.</p>
  492. </div>
  493. <table class="params">
  494. <tbody>
  495. <tr>
  496. <td class="name">
  497. <strong>eye</strong>
  498. </td>
  499. <td class="description last">
  500. <p>The eye vector.</p>
  501. </td>
  502. </tr>
  503. <tr>
  504. <td class="name">
  505. <strong>target</strong>
  506. </td>
  507. <td class="description last">
  508. <p>The target vector.</p>
  509. </td>
  510. </tr>
  511. <tr>
  512. <td class="name">
  513. <strong>up</strong>
  514. </td>
  515. <td class="description last">
  516. <p>The up vector.</p>
  517. </td>
  518. </tr>
  519. </tbody>
  520. </table>
  521. <dl class="details">
  522. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  523. </dl>
  524. </div>
  525. <h3 class="name name-method" id="makeBasis" translate="no">.<a href="#makeBasis">makeBasis</a><span class="signature">( xAxis : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, yAxis : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, zAxis : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  526. <div class="method">
  527. <div class="description">
  528. <p>Sets the given basis vectors to this matrix.</p>
  529. </div>
  530. <table class="params">
  531. <tbody>
  532. <tr>
  533. <td class="name">
  534. <strong>xAxis</strong>
  535. </td>
  536. <td class="description last">
  537. <p>The basis's x axis.</p>
  538. </td>
  539. </tr>
  540. <tr>
  541. <td class="name">
  542. <strong>yAxis</strong>
  543. </td>
  544. <td class="description last">
  545. <p>The basis's y axis.</p>
  546. </td>
  547. </tr>
  548. <tr>
  549. <td class="name">
  550. <strong>zAxis</strong>
  551. </td>
  552. <td class="description last">
  553. <p>The basis's z axis.</p>
  554. </td>
  555. </tr>
  556. </tbody>
  557. </table>
  558. <dl class="details">
  559. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  560. </dl>
  561. </div>
  562. <h3 class="name name-method" id="makeOrthographic" translate="no">.<a href="#makeOrthographic">makeOrthographic</a><span class="signature">( left : <span class="param-type">number</span>, right : <span class="param-type">number</span>, top : <span class="param-type">number</span>, bottom : <span class="param-type">number</span>, near : <span class="param-type">number</span>, far : <span class="param-type">number</span>, coordinateSystem : <span class="param-type"><a href="global.html#WebGLCoordinateSystem">WebGLCoordinateSystem</a> | <a href="global.html#WebGPUCoordinateSystem">WebGPUCoordinateSystem</a></span>, reversedDepth : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  563. <div class="method">
  564. <div class="description">
  565. <p>Creates a orthographic projection matrix. This is used internally by
  566. <a href="OrthographicCamera.html#updateProjectionMatrix">OrthographicCamera#updateProjectionMatrix</a>.</p>
  567. </div>
  568. <table class="params">
  569. <tbody>
  570. <tr>
  571. <td class="name">
  572. <strong>left</strong>
  573. </td>
  574. <td class="description last">
  575. <p>Left boundary of the viewing frustum at the near plane.</p>
  576. </td>
  577. </tr>
  578. <tr>
  579. <td class="name">
  580. <strong>right</strong>
  581. </td>
  582. <td class="description last">
  583. <p>Right boundary of the viewing frustum at the near plane.</p>
  584. </td>
  585. </tr>
  586. <tr>
  587. <td class="name">
  588. <strong>top</strong>
  589. </td>
  590. <td class="description last">
  591. <p>Top boundary of the viewing frustum at the near plane.</p>
  592. </td>
  593. </tr>
  594. <tr>
  595. <td class="name">
  596. <strong>bottom</strong>
  597. </td>
  598. <td class="description last">
  599. <p>Bottom boundary of the viewing frustum at the near plane.</p>
  600. </td>
  601. </tr>
  602. <tr>
  603. <td class="name">
  604. <strong>near</strong>
  605. </td>
  606. <td class="description last">
  607. <p>The distance from the camera to the near plane.</p>
  608. </td>
  609. </tr>
  610. <tr>
  611. <td class="name">
  612. <strong>far</strong>
  613. </td>
  614. <td class="description last">
  615. <p>The distance from the camera to the far plane.</p>
  616. </td>
  617. </tr>
  618. <tr>
  619. <td class="name">
  620. <strong>coordinateSystem</strong>
  621. </td>
  622. <td class="description last">
  623. <p>The coordinate system.</p>
  624. <p>Default is <code>WebGLCoordinateSystem</code>.</p>
  625. </td>
  626. </tr>
  627. <tr>
  628. <td class="name">
  629. <strong>reversedDepth</strong>
  630. </td>
  631. <td class="description last">
  632. <p>Whether to use a reversed depth.</p>
  633. <p>Default is <code>false</code>.</p>
  634. </td>
  635. </tr>
  636. </tbody>
  637. </table>
  638. <dl class="details">
  639. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  640. </dl>
  641. </div>
  642. <h3 class="name name-method" id="makePerspective" translate="no">.<a href="#makePerspective">makePerspective</a><span class="signature">( left : <span class="param-type">number</span>, right : <span class="param-type">number</span>, top : <span class="param-type">number</span>, bottom : <span class="param-type">number</span>, near : <span class="param-type">number</span>, far : <span class="param-type">number</span>, coordinateSystem : <span class="param-type"><a href="global.html#WebGLCoordinateSystem">WebGLCoordinateSystem</a> | <a href="global.html#WebGPUCoordinateSystem">WebGPUCoordinateSystem</a></span>, reversedDepth : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  643. <div class="method">
  644. <div class="description">
  645. <p>Creates a perspective projection matrix. This is used internally by
  646. <a href="PerspectiveCamera.html#updateProjectionMatrix">PerspectiveCamera#updateProjectionMatrix</a>.</p>
  647. </div>
  648. <table class="params">
  649. <tbody>
  650. <tr>
  651. <td class="name">
  652. <strong>left</strong>
  653. </td>
  654. <td class="description last">
  655. <p>Left boundary of the viewing frustum at the near plane.</p>
  656. </td>
  657. </tr>
  658. <tr>
  659. <td class="name">
  660. <strong>right</strong>
  661. </td>
  662. <td class="description last">
  663. <p>Right boundary of the viewing frustum at the near plane.</p>
  664. </td>
  665. </tr>
  666. <tr>
  667. <td class="name">
  668. <strong>top</strong>
  669. </td>
  670. <td class="description last">
  671. <p>Top boundary of the viewing frustum at the near plane.</p>
  672. </td>
  673. </tr>
  674. <tr>
  675. <td class="name">
  676. <strong>bottom</strong>
  677. </td>
  678. <td class="description last">
  679. <p>Bottom boundary of the viewing frustum at the near plane.</p>
  680. </td>
  681. </tr>
  682. <tr>
  683. <td class="name">
  684. <strong>near</strong>
  685. </td>
  686. <td class="description last">
  687. <p>The distance from the camera to the near plane.</p>
  688. </td>
  689. </tr>
  690. <tr>
  691. <td class="name">
  692. <strong>far</strong>
  693. </td>
  694. <td class="description last">
  695. <p>The distance from the camera to the far plane.</p>
  696. </td>
  697. </tr>
  698. <tr>
  699. <td class="name">
  700. <strong>coordinateSystem</strong>
  701. </td>
  702. <td class="description last">
  703. <p>The coordinate system.</p>
  704. <p>Default is <code>WebGLCoordinateSystem</code>.</p>
  705. </td>
  706. </tr>
  707. <tr>
  708. <td class="name">
  709. <strong>reversedDepth</strong>
  710. </td>
  711. <td class="description last">
  712. <p>Whether to use a reversed depth.</p>
  713. <p>Default is <code>false</code>.</p>
  714. </td>
  715. </tr>
  716. </tbody>
  717. </table>
  718. <dl class="details">
  719. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  720. </dl>
  721. </div>
  722. <h3 class="name name-method" id="makeRotationAxis" translate="no">.<a href="#makeRotationAxis">makeRotationAxis</a><span class="signature">( axis : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, angle : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  723. <div class="method">
  724. <div class="description">
  725. <p>Sets this matrix as a rotational transformation around the given axis by
  726. the given angle.</p>
  727. <p>This is a somewhat controversial but mathematically sound alternative to
  728. rotating via Quaternions. See the discussion <a href="https://www.gamedev.net/articles/programming/math-and-physics/do-we-really-need-quaternions-r1199" target="_blank" rel="noopener">here</a>.</p>
  729. </div>
  730. <table class="params">
  731. <tbody>
  732. <tr>
  733. <td class="name">
  734. <strong>axis</strong>
  735. </td>
  736. <td class="description last">
  737. <p>The normalized rotation axis.</p>
  738. </td>
  739. </tr>
  740. <tr>
  741. <td class="name">
  742. <strong>angle</strong>
  743. </td>
  744. <td class="description last">
  745. <p>The rotation in radians.</p>
  746. </td>
  747. </tr>
  748. </tbody>
  749. </table>
  750. <dl class="details">
  751. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  752. </dl>
  753. </div>
  754. <h3 class="name name-method" id="makeRotationFromEuler" translate="no">.<a href="#makeRotationFromEuler">makeRotationFromEuler</a><span class="signature">( euler : <span class="param-type"><a href="Euler.html">Euler</a></span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  755. <div class="method">
  756. <div class="description">
  757. <p>Sets the rotation component (the upper left 3x3 matrix) of this matrix to
  758. the rotation specified by the given Euler angles. The rest of
  759. the matrix is set to the identity. Depending on the <a href="Euler.html#order">Euler#order</a>,
  760. there are six possible outcomes. See <a href="https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix" target="_blank" rel="noopener">this page</a>
  761. for a complete list.</p>
  762. </div>
  763. <table class="params">
  764. <tbody>
  765. <tr>
  766. <td class="name">
  767. <strong>euler</strong>
  768. </td>
  769. <td class="description last">
  770. <p>The Euler angles.</p>
  771. </td>
  772. </tr>
  773. </tbody>
  774. </table>
  775. <dl class="details">
  776. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  777. </dl>
  778. </div>
  779. <h3 class="name name-method" id="makeRotationFromQuaternion" translate="no">.<a href="#makeRotationFromQuaternion">makeRotationFromQuaternion</a><span class="signature">( q : <span class="param-type"><a href="Quaternion.html">Quaternion</a></span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  780. <div class="method">
  781. <div class="description">
  782. <p>Sets the rotation component of this matrix to the rotation specified by
  783. the given Quaternion as outlined <a href="https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion" target="_blank" rel="noopener">here</a>
  784. The rest of the matrix is set to the identity.</p>
  785. </div>
  786. <table class="params">
  787. <tbody>
  788. <tr>
  789. <td class="name">
  790. <strong>q</strong>
  791. </td>
  792. <td class="description last">
  793. <p>The Quaternion.</p>
  794. </td>
  795. </tr>
  796. </tbody>
  797. </table>
  798. <dl class="details">
  799. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  800. </dl>
  801. </div>
  802. <h3 class="name name-method" id="makeRotationX" translate="no">.<a href="#makeRotationX">makeRotationX</a><span class="signature">( theta : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  803. <div class="method">
  804. <div class="description">
  805. <p>Sets this matrix as a rotational transformation around the X axis by
  806. the given angle.</p>
  807. </div>
  808. <table class="params">
  809. <tbody>
  810. <tr>
  811. <td class="name">
  812. <strong>theta</strong>
  813. </td>
  814. <td class="description last">
  815. <p>The rotation in radians.</p>
  816. </td>
  817. </tr>
  818. </tbody>
  819. </table>
  820. <dl class="details">
  821. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  822. </dl>
  823. </div>
  824. <h3 class="name name-method" id="makeRotationY" translate="no">.<a href="#makeRotationY">makeRotationY</a><span class="signature">( theta : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  825. <div class="method">
  826. <div class="description">
  827. <p>Sets this matrix as a rotational transformation around the Y axis by
  828. the given angle.</p>
  829. </div>
  830. <table class="params">
  831. <tbody>
  832. <tr>
  833. <td class="name">
  834. <strong>theta</strong>
  835. </td>
  836. <td class="description last">
  837. <p>The rotation in radians.</p>
  838. </td>
  839. </tr>
  840. </tbody>
  841. </table>
  842. <dl class="details">
  843. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  844. </dl>
  845. </div>
  846. <h3 class="name name-method" id="makeRotationZ" translate="no">.<a href="#makeRotationZ">makeRotationZ</a><span class="signature">( theta : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  847. <div class="method">
  848. <div class="description">
  849. <p>Sets this matrix as a rotational transformation around the Z axis by
  850. the given angle.</p>
  851. </div>
  852. <table class="params">
  853. <tbody>
  854. <tr>
  855. <td class="name">
  856. <strong>theta</strong>
  857. </td>
  858. <td class="description last">
  859. <p>The rotation in radians.</p>
  860. </td>
  861. </tr>
  862. </tbody>
  863. </table>
  864. <dl class="details">
  865. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  866. </dl>
  867. </div>
  868. <h3 class="name name-method" id="makeScale" translate="no">.<a href="#makeScale">makeScale</a><span class="signature">( x : <span class="param-type">number</span>, y : <span class="param-type">number</span>, z : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  869. <div class="method">
  870. <div class="description">
  871. <p>Sets this matrix as a scale transformation.</p>
  872. </div>
  873. <table class="params">
  874. <tbody>
  875. <tr>
  876. <td class="name">
  877. <strong>x</strong>
  878. </td>
  879. <td class="description last">
  880. <p>The amount to scale in the X axis.</p>
  881. </td>
  882. </tr>
  883. <tr>
  884. <td class="name">
  885. <strong>y</strong>
  886. </td>
  887. <td class="description last">
  888. <p>The amount to scale in the Y axis.</p>
  889. </td>
  890. </tr>
  891. <tr>
  892. <td class="name">
  893. <strong>z</strong>
  894. </td>
  895. <td class="description last">
  896. <p>The amount to scale in the Z axis.</p>
  897. </td>
  898. </tr>
  899. </tbody>
  900. </table>
  901. <dl class="details">
  902. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  903. </dl>
  904. </div>
  905. <h3 class="name name-method" id="makeShear" translate="no">.<a href="#makeShear">makeShear</a><span class="signature">( xy : <span class="param-type">number</span>, xz : <span class="param-type">number</span>, yx : <span class="param-type">number</span>, yz : <span class="param-type">number</span>, zx : <span class="param-type">number</span>, zy : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  906. <div class="method">
  907. <div class="description">
  908. <p>Sets this matrix as a shear transformation.</p>
  909. </div>
  910. <table class="params">
  911. <tbody>
  912. <tr>
  913. <td class="name">
  914. <strong>xy</strong>
  915. </td>
  916. <td class="description last">
  917. <p>The amount to shear X by Y.</p>
  918. </td>
  919. </tr>
  920. <tr>
  921. <td class="name">
  922. <strong>xz</strong>
  923. </td>
  924. <td class="description last">
  925. <p>The amount to shear X by Z.</p>
  926. </td>
  927. </tr>
  928. <tr>
  929. <td class="name">
  930. <strong>yx</strong>
  931. </td>
  932. <td class="description last">
  933. <p>The amount to shear Y by X.</p>
  934. </td>
  935. </tr>
  936. <tr>
  937. <td class="name">
  938. <strong>yz</strong>
  939. </td>
  940. <td class="description last">
  941. <p>The amount to shear Y by Z.</p>
  942. </td>
  943. </tr>
  944. <tr>
  945. <td class="name">
  946. <strong>zx</strong>
  947. </td>
  948. <td class="description last">
  949. <p>The amount to shear Z by X.</p>
  950. </td>
  951. </tr>
  952. <tr>
  953. <td class="name">
  954. <strong>zy</strong>
  955. </td>
  956. <td class="description last">
  957. <p>The amount to shear Z by Y.</p>
  958. </td>
  959. </tr>
  960. </tbody>
  961. </table>
  962. <dl class="details">
  963. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  964. </dl>
  965. </div>
  966. <h3 class="name name-method" id="makeTranslation" translate="no">.<a href="#makeTranslation">makeTranslation</a><span class="signature">( x : <span class="param-type">number | <a href="Vector3.html">Vector3</a></span>, y : <span class="param-type">number</span>, z : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  967. <div class="method">
  968. <div class="description">
  969. <p>Sets this matrix as a translation transform from the given vector.</p>
  970. </div>
  971. <table class="params">
  972. <tbody>
  973. <tr>
  974. <td class="name">
  975. <strong>x</strong>
  976. </td>
  977. <td class="description last">
  978. <p>The amount to translate in the X axis or alternatively a translation vector.</p>
  979. </td>
  980. </tr>
  981. <tr>
  982. <td class="name">
  983. <strong>y</strong>
  984. </td>
  985. <td class="description last">
  986. <p>The amount to translate in the Y axis.</p>
  987. </td>
  988. </tr>
  989. <tr>
  990. <td class="name">
  991. <strong>z</strong>
  992. </td>
  993. <td class="description last">
  994. <p>The amount to translate in the z axis.</p>
  995. </td>
  996. </tr>
  997. </tbody>
  998. </table>
  999. <dl class="details">
  1000. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  1001. </dl>
  1002. </div>
  1003. <h3 class="name name-method" id="multiply" translate="no">.<a href="#multiply">multiply</a><span class="signature">( m : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  1004. <div class="method">
  1005. <div class="description">
  1006. <p>Post-multiplies this matrix by the given 4x4 matrix.</p>
  1007. </div>
  1008. <table class="params">
  1009. <tbody>
  1010. <tr>
  1011. <td class="name">
  1012. <strong>m</strong>
  1013. </td>
  1014. <td class="description last">
  1015. <p>The matrix to multiply with.</p>
  1016. </td>
  1017. </tr>
  1018. </tbody>
  1019. </table>
  1020. <dl class="details">
  1021. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  1022. </dl>
  1023. </div>
  1024. <h3 class="name name-method" id="multiplyMatrices" translate="no">.<a href="#multiplyMatrices">multiplyMatrices</a><span class="signature">( a : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span>, b : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  1025. <div class="method">
  1026. <div class="description">
  1027. <p>Multiples the given 4x4 matrices and stores the result
  1028. in this matrix.</p>
  1029. </div>
  1030. <table class="params">
  1031. <tbody>
  1032. <tr>
  1033. <td class="name">
  1034. <strong>a</strong>
  1035. </td>
  1036. <td class="description last">
  1037. <p>The first matrix.</p>
  1038. </td>
  1039. </tr>
  1040. <tr>
  1041. <td class="name">
  1042. <strong>b</strong>
  1043. </td>
  1044. <td class="description last">
  1045. <p>The second matrix.</p>
  1046. </td>
  1047. </tr>
  1048. </tbody>
  1049. </table>
  1050. <dl class="details">
  1051. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  1052. </dl>
  1053. </div>
  1054. <h3 class="name name-method" id="multiplyScalar" translate="no">.<a href="#multiplyScalar">multiplyScalar</a><span class="signature">( s : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  1055. <div class="method">
  1056. <div class="description">
  1057. <p>Multiplies every component of the matrix by the given scalar.</p>
  1058. </div>
  1059. <table class="params">
  1060. <tbody>
  1061. <tr>
  1062. <td class="name">
  1063. <strong>s</strong>
  1064. </td>
  1065. <td class="description last">
  1066. <p>The scalar.</p>
  1067. </td>
  1068. </tr>
  1069. </tbody>
  1070. </table>
  1071. <dl class="details">
  1072. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  1073. </dl>
  1074. </div>
  1075. <h3 class="name name-method" id="premultiply" translate="no">.<a href="#premultiply">premultiply</a><span class="signature">( m : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  1076. <div class="method">
  1077. <div class="description">
  1078. <p>Pre-multiplies this matrix by the given 4x4 matrix.</p>
  1079. </div>
  1080. <table class="params">
  1081. <tbody>
  1082. <tr>
  1083. <td class="name">
  1084. <strong>m</strong>
  1085. </td>
  1086. <td class="description last">
  1087. <p>The matrix to multiply with.</p>
  1088. </td>
  1089. </tr>
  1090. </tbody>
  1091. </table>
  1092. <dl class="details">
  1093. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  1094. </dl>
  1095. </div>
  1096. <h3 class="name name-method" id="scale" translate="no">.<a href="#scale">scale</a><span class="signature">( v : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  1097. <div class="method">
  1098. <div class="description">
  1099. <p>Multiplies the columns of this matrix by the given vector.</p>
  1100. </div>
  1101. <table class="params">
  1102. <tbody>
  1103. <tr>
  1104. <td class="name">
  1105. <strong>v</strong>
  1106. </td>
  1107. <td class="description last">
  1108. <p>The scale vector.</p>
  1109. </td>
  1110. </tr>
  1111. </tbody>
  1112. </table>
  1113. <dl class="details">
  1114. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  1115. </dl>
  1116. </div>
  1117. <h3 class="name name-method" id="set" translate="no">.<a href="#set">set</a><span class="signature">( n11 : <span class="param-type">number</span>, n12 : <span class="param-type">number</span>, n13 : <span class="param-type">number</span>, n14 : <span class="param-type">number</span>, n21 : <span class="param-type">number</span>, n22 : <span class="param-type">number</span>, n23 : <span class="param-type">number</span>, n24 : <span class="param-type">number</span>, n31 : <span class="param-type">number</span>, n32 : <span class="param-type">number</span>, n33 : <span class="param-type">number</span>, n34 : <span class="param-type">number</span>, n41 : <span class="param-type">number</span>, n42 : <span class="param-type">number</span>, n43 : <span class="param-type">number</span>, n44 : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  1118. <div class="method">
  1119. <div class="description">
  1120. <p>Sets the elements of the matrix.The arguments are supposed to be
  1121. in row-major order.</p>
  1122. </div>
  1123. <table class="params">
  1124. <tbody>
  1125. <tr>
  1126. <td class="name">
  1127. <strong>n11</strong>
  1128. </td>
  1129. <td class="description last">
  1130. <p>1-1 matrix element.</p>
  1131. </td>
  1132. </tr>
  1133. <tr>
  1134. <td class="name">
  1135. <strong>n12</strong>
  1136. </td>
  1137. <td class="description last">
  1138. <p>1-2 matrix element.</p>
  1139. </td>
  1140. </tr>
  1141. <tr>
  1142. <td class="name">
  1143. <strong>n13</strong>
  1144. </td>
  1145. <td class="description last">
  1146. <p>1-3 matrix element.</p>
  1147. </td>
  1148. </tr>
  1149. <tr>
  1150. <td class="name">
  1151. <strong>n14</strong>
  1152. </td>
  1153. <td class="description last">
  1154. <p>1-4 matrix element.</p>
  1155. </td>
  1156. </tr>
  1157. <tr>
  1158. <td class="name">
  1159. <strong>n21</strong>
  1160. </td>
  1161. <td class="description last">
  1162. <p>2-1 matrix element.</p>
  1163. </td>
  1164. </tr>
  1165. <tr>
  1166. <td class="name">
  1167. <strong>n22</strong>
  1168. </td>
  1169. <td class="description last">
  1170. <p>2-2 matrix element.</p>
  1171. </td>
  1172. </tr>
  1173. <tr>
  1174. <td class="name">
  1175. <strong>n23</strong>
  1176. </td>
  1177. <td class="description last">
  1178. <p>2-3 matrix element.</p>
  1179. </td>
  1180. </tr>
  1181. <tr>
  1182. <td class="name">
  1183. <strong>n24</strong>
  1184. </td>
  1185. <td class="description last">
  1186. <p>2-4 matrix element.</p>
  1187. </td>
  1188. </tr>
  1189. <tr>
  1190. <td class="name">
  1191. <strong>n31</strong>
  1192. </td>
  1193. <td class="description last">
  1194. <p>3-1 matrix element.</p>
  1195. </td>
  1196. </tr>
  1197. <tr>
  1198. <td class="name">
  1199. <strong>n32</strong>
  1200. </td>
  1201. <td class="description last">
  1202. <p>3-2 matrix element.</p>
  1203. </td>
  1204. </tr>
  1205. <tr>
  1206. <td class="name">
  1207. <strong>n33</strong>
  1208. </td>
  1209. <td class="description last">
  1210. <p>3-3 matrix element.</p>
  1211. </td>
  1212. </tr>
  1213. <tr>
  1214. <td class="name">
  1215. <strong>n34</strong>
  1216. </td>
  1217. <td class="description last">
  1218. <p>3-4 matrix element.</p>
  1219. </td>
  1220. </tr>
  1221. <tr>
  1222. <td class="name">
  1223. <strong>n41</strong>
  1224. </td>
  1225. <td class="description last">
  1226. <p>4-1 matrix element.</p>
  1227. </td>
  1228. </tr>
  1229. <tr>
  1230. <td class="name">
  1231. <strong>n42</strong>
  1232. </td>
  1233. <td class="description last">
  1234. <p>4-2 matrix element.</p>
  1235. </td>
  1236. </tr>
  1237. <tr>
  1238. <td class="name">
  1239. <strong>n43</strong>
  1240. </td>
  1241. <td class="description last">
  1242. <p>4-3 matrix element.</p>
  1243. </td>
  1244. </tr>
  1245. <tr>
  1246. <td class="name">
  1247. <strong>n44</strong>
  1248. </td>
  1249. <td class="description last">
  1250. <p>4-4 matrix element.</p>
  1251. </td>
  1252. </tr>
  1253. </tbody>
  1254. </table>
  1255. <dl class="details">
  1256. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  1257. </dl>
  1258. </div>
  1259. <h3 class="name name-method" id="setFromMatrix3" translate="no">.<a href="#setFromMatrix3">setFromMatrix3</a><span class="signature">( m : <span class="param-type"><a href="Matrix3.html">Matrix3</a></span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  1260. <div class="method">
  1261. <div class="description">
  1262. <p>Set the upper 3x3 elements of this matrix to the values of given 3x3 matrix.</p>
  1263. </div>
  1264. <table class="params">
  1265. <tbody>
  1266. <tr>
  1267. <td class="name">
  1268. <strong>m</strong>
  1269. </td>
  1270. <td class="description last">
  1271. <p>The 3x3 matrix.</p>
  1272. </td>
  1273. </tr>
  1274. </tbody>
  1275. </table>
  1276. <dl class="details">
  1277. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  1278. </dl>
  1279. </div>
  1280. <h3 class="name name-method" id="setPosition" translate="no">.<a href="#setPosition">setPosition</a><span class="signature">( x : <span class="param-type">number | <a href="Vector3.html">Vector3</a></span>, y : <span class="param-type">number</span>, z : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  1281. <div class="method">
  1282. <div class="description">
  1283. <p>Sets the position component for this matrix from the given vector,
  1284. without affecting the rest of the matrix.</p>
  1285. </div>
  1286. <table class="params">
  1287. <tbody>
  1288. <tr>
  1289. <td class="name">
  1290. <strong>x</strong>
  1291. </td>
  1292. <td class="description last">
  1293. <p>The x component of the vector or alternatively the vector object.</p>
  1294. </td>
  1295. </tr>
  1296. <tr>
  1297. <td class="name">
  1298. <strong>y</strong>
  1299. </td>
  1300. <td class="description last">
  1301. <p>The y component of the vector.</p>
  1302. </td>
  1303. </tr>
  1304. <tr>
  1305. <td class="name">
  1306. <strong>z</strong>
  1307. </td>
  1308. <td class="description last">
  1309. <p>The z component of the vector.</p>
  1310. </td>
  1311. </tr>
  1312. </tbody>
  1313. </table>
  1314. <dl class="details">
  1315. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  1316. </dl>
  1317. </div>
  1318. <h3 class="name name-method" id="toArray" translate="no">.<a href="#toArray">toArray</a><span class="signature">( array : <span class="param-type">Array.&lt;number></span>, offset : <span class="param-type">number</span> )</span><span class="type-signature"> : Array.&lt;number></span> </h3>
  1319. <div class="method">
  1320. <div class="description">
  1321. <p>Writes the elements of this matrix to the given array. If no array is provided,
  1322. the method returns a new instance.</p>
  1323. </div>
  1324. <table class="params">
  1325. <tbody>
  1326. <tr>
  1327. <td class="name">
  1328. <strong>array</strong>
  1329. </td>
  1330. <td class="description last">
  1331. <p>The target array holding the matrix elements in column-major order.</p>
  1332. <p>Default is <code>[]</code>.</p>
  1333. </td>
  1334. </tr>
  1335. <tr>
  1336. <td class="name">
  1337. <strong>offset</strong>
  1338. </td>
  1339. <td class="description last">
  1340. <p>Index of the first element in the array.</p>
  1341. <p>Default is <code>0</code>.</p>
  1342. </td>
  1343. </tr>
  1344. </tbody>
  1345. </table>
  1346. <dl class="details">
  1347. <dt class="tag-returns"><strong>Returns:</strong> The matrix elements in column-major order.</dt>
  1348. </dl>
  1349. </div>
  1350. <h3 class="name name-method" id="transpose" translate="no">.<a href="#transpose">transpose</a><span class="signature">()</span><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  1351. <div class="method">
  1352. <div class="description">
  1353. <p>Transposes this matrix in place.</p>
  1354. </div>
  1355. <dl class="details">
  1356. <dt class="tag-returns"><strong>Returns:</strong> A reference to this matrix.</dt>
  1357. </dl>
  1358. </div>
  1359. <h2 class="subsection-title">Source</h2>
  1360. <p>
  1361. <a href="https://github.com/mrdoob/three.js/blob/master/src/math/Matrix4.js" translate="no" target="_blank" rel="noopener">src/math/Matrix4.js</a>
  1362. </p>
  1363. </article>
  1364. </section>
  1365. <script src="../scripts/linenumber.js"></script>
  1366. <script src="../scripts/page.js"></script>
  1367. </body>
  1368. </html>
粤ICP备19079148号