2
0

Matrix4.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921
  1. <!DOCTYPE html>
  2. <html lang="it">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  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. <p class="desc">
  12. Una classe che rappresenta una [link:https://en.wikipedia.org/wiki/Matrix_(mathematics) matrice] 4x4.<br /><br />
  13. L'uso più comune di una matrice 4x4 nella grafica 3D è come una
  14. [link:https://en.wikipedia.org/wiki/Transformation_matrix matrice di trasformazione].
  15. Per un'introduzione alle matrici di trasformazione utilizzate in WebGL,
  16. dai un'occhiata a [link:http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices questo tutorial].<br /><br />
  17. Ciò consente ad un [page:Vector3] che rappresenta un punto nello spazio 3D di subire trasformazioni come traslazione, rotazione
  18. taglio, scala, riflessione, proiezione ortogonale o prospettica e così via, moltiplicandosi per la matrice.
  19. Questo è noto come `applicare` la matrice al vettore.<br /><br />
  20. Ogni [page:Object3D] ha tre Matrix4 associate:
  21. <ul>
  22. <li>
  23. [page:Object3D.matrix]: Questo memorizza la trasfomazione locale dell'oggetto. Questa è la trasformazione dell'oggetto rispetto al suo genitore.
  24. </li>
  25. <li>
  26. [page:Object3D.matrixWorld]: La trasformazione globale o world dell'oggetto. Se l'oggetto non ha un genitore, allora questo è identico
  27. alla trasformazione locale memorizzata nella [page:Object3D.matrix matrix].
  28. </li>
  29. <li>
  30. [page:Object3D.modelViewMatrix]: Questo rappresenta la trasformazione dell'oggetto rispetto al sistema di coordinate della telecamera.
  31. Il modelViewMatrix dell'oggetto è il matrixWorld dell'oggetto pre-moltiplicato per il matrixWorldInverse della telecamera.
  32. </li>
  33. </ul>
  34. Le [page:Camera Telecamere] hanno tre Matrix4 addizionali:
  35. <ul>
  36. <li>
  37. [page:Camera.matrixWorldInverse]: La matrice di visualizzazione - l'inversa della [page:Object3D.matrixWorld matrixWorld] della telecamera.
  38. </li>
  39. <li>
  40. [page:Camera.projectionMatrix]: Rappresenta le informazioni su come proiettare la scena nello spazio di ritaglio.
  41. </li>
  42. <li>
  43. [page:Camera.projectionMatrixInverse]: L'inverso della projectionMatrix.
  44. </li>
  45. </ul>
  46. Nota: [page:Object3D.normalMatrix] non è una Matrix4, ma una [page:Matrix3].
  47. </p>
  48. <h2>Una nota sull'ordine delle Row-Major (righe principali) e delle Column-Major (colonne principali)</h2>
  49. <p>
  50. Il metodo [page:.set set]() accetta gli argomenti in ordine
  51. [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order row-major], mentre internamente
  52. vengono memorizzati nell'array [page:.elements elements] nell'ordine column-major.<br /><br />
  53. Ciò significa che la chiamata a
  54. <code>
  55. const m = new THREE.Matrix4();
  56. m.set( 11, 12, 13, 14,
  57. 21, 22, 23, 24,
  58. 31, 32, 33, 34,
  59. 41, 42, 43, 44 );
  60. </code>
  61. risulterà nell'array [page:.elements elements] contenente:
  62. <code>
  63. m.elements = [ 11, 21, 31, 41,
  64. 12, 22, 32, 42,
  65. 13, 23, 33, 43,
  66. 14, 24, 34, 44 ];
  67. </code>
  68. e internamente tutti i calcoli vengono eseguiti utilizzando l'ordine column-major. Tuttavia, poiché l'ordine
  69. effettivo non fa alcune differenza matematicamente e la maggior parte delle persone è abituata a pensare alle
  70. matrici nell'ordine row-major, la documentazione di three.js mostra le matrici in ordine di row-major.
  71. Tieni solo a mente che se stai leggendo il codice sorgente, dovrai prendere la [link:https://en.wikipedia.org/wiki/Transpose trasposizione]
  72. di tutte le matrici qui descritte per dare un senso ai calcoli.
  73. </p>
  74. <h2>Estrazione della posizione, della rotazione e del ridimensionamento</h2>
  75. <p>
  76. Ci sono molte opzioni disponibili per l'estrazione della posizione, della rotazione e del ridimensionamento da una Matrix4.
  77. <ul>
  78. <li>
  79. [page:Vector3.setFromMatrixPosition]: può essere utilizzato per estrarre il componente traslazione.
  80. </li>
  81. <li>
  82. [page:Vector3.setFromMatrixScale]: può essere utilizzato per estrarre il componente ridimensionamento.
  83. </li>
  84. <li>
  85. [page:Quaternion.setFromRotationMatrix], [page:Euler.setFromRotationMatrix] o [page:.extractRotation extractRotation]
  86. può essere utilizzato per estrarre il componente rotazione da una matrice pura (non ridimensionata).
  87. </li>
  88. <li>
  89. [page:.decompose decompose] può essere utilizzato per estrarre la posizione, la rotazione e il ridemsionamento tutti in uno.
  90. </li>
  91. </ul>
  92. </p>
  93. <h2>Costruttore</h2>
  94. <h3>[name]( [param:Number n11], [param:Number n12], [param:Number n13], [param:Number n14],
  95. [param:Number n21], [param:Number n22], [param:Number n23], [param:Number n24],
  96. [param:Number n31], [param:Number n32], [param:Number n33], [param:Number n34],
  97. [param:Number n41], [param:Number n42], [param:Number n43], [param:Number n44] )</h3>
  98. <p>
  99. Creates a 4x4 matrix with the given arguments in row-major order. If no arguments are provided, the constructor initializes
  100. the [name] to the 4x4 [link:https://en.wikipedia.org/wiki/Identity_matrix identity matrix].
  101. </p>
  102. <h2>Proprietà</h2>
  103. <h3>[property:Array elements]</h3>
  104. <p>
  105. Una lista di [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order column-major]
  106. di valori della matrice.
  107. </p>
  108. <h2>Metodi</h2>
  109. <h3>[method:Matrix4 clone]()</h3>
  110. <p>Crea una nuova Matrix4 con gli [page:.elements elementi] identici a questa.</p>
  111. <h3>[method:this compose]( [param:Vector3 position], [param:Quaternion quaternion], [param:Vector3 scale] )</h3>
  112. <p>
  113. Imposta questa matrice sulla trasformazione composta da [page:Vector3 posizione],
  114. [page:Quaternion quaternione] e [page:Vector3 ridimensionamento].
  115. </p>
  116. <h3>[method:this copy]( [param:Matrix4 m] )</h3>
  117. <p>Copia gli [page:.elements elementi] della matrice [page:Matrix4 m] in questa matrice.</p>
  118. <h3>[method:this copyPosition]( [param:Matrix4 m] )</h3>
  119. <p>
  120. Copia il componente traslazione della matrice [page:Matrix4 m] fornita nel componente
  121. trasformazione di questa matrice.
  122. </p>
  123. <h3>[method:this decompose]( [param:Vector3 position], [param:Quaternion quaternion], [param:Vector3 scale] )</h3>
  124. <p>
  125. Decompone questa matrice nei suoi componenti [page:Vector3 posizione], [page:Quaternion quaternione] e [page:Vector3 ridimensionamento].<br/><br/>
  126. Nota: Non tutte le matrici si possono scomporre in questo modo. Per esempio, se un oggetto ha un genitore ridimensionato non uniformemente,
  127. allora la matrice del mondo dell'oggetto potrebbe non essere scomponibile e questo metodo potrebbe non essere appropriato.
  128. </p>
  129. <h3>[method:Float determinant]()</h3>
  130. <p>
  131. Calcola e restituisce il
  132. [link:https://en.wikipedia.org/wiki/Determinant determinante] di questa matrice.<br /><br />
  133. Sulla base del metodo [link:http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm qui] descritto.
  134. </p>
  135. <h3>[method:Boolean equals]( [param:Matrix4 m] )</h3>
  136. <p>Restituisce true se questa matrice e [page:Matrix4 m] sono uguali.</p>
  137. <h3>[method:this extractBasis]( [param:Vector3 xAxis], [param:Vector3 yAxis], [param:Vector3 zAxis] )</h3>
  138. <p>
  139. Estrae la [link:https://en.wikipedia.org/wiki/Basis_(linear_algebra) base] di questa matrice
  140. nei tre vettori asse forniti. Se questa matrice è:
  141. </p>
  142. <math display="block">
  143. <mrow>
  144. <mo>[</mo>
  145. <mtable>
  146. <mtr>
  147. <mtd><mi>a</mi></mtd>
  148. <mtd><mi>b</mi></mtd>
  149. <mtd><mi>c</mi></mtd>
  150. <mtd><mi>d</mi></mtd>
  151. </mtr>
  152. <mtr>
  153. <mtd><mi>e</mi></mtd>
  154. <mtd><mi>f</mi></mtd>
  155. <mtd><mi>g</mi></mtd>
  156. <mtd><mi>h</mi></mtd>
  157. </mtr>
  158. <mtr>
  159. <mtd><mi>i</mi></mtd>
  160. <mtd><mi>j</mi></mtd>
  161. <mtd><mi>k</mi></mtd>
  162. <mtd><mi>l</mi></mtd>
  163. </mtr>
  164. <mtr>
  165. <mtd><mi>m</mi></mtd>
  166. <mtd><mi>n</mi></mtd>
  167. <mtd><mi>o</mi></mtd>
  168. <mtd><mi>p</mi></mtd>
  169. </mtr>
  170. </mtable>
  171. <mo>]</mo>
  172. </mrow>
  173. </math>
  174. <p>
  175. then the [page:Vector3 xAxis], [page:Vector3 yAxis], [page:Vector3 zAxis]
  176. will be set to:
  177. </p>
  178. <div style="text-align: center">
  179. <math>
  180. <mrow>
  181. <mi>xAxis</mi>
  182. <mo>=</mo>
  183. <mo>[</mo>
  184. <mtable>
  185. <mtr><mtd style="height: 1rem"><mi>a</mi></mtd></mtr>
  186. <mtr><mtd style="height: 1rem"><mi>e</mi></mtd></mtr>
  187. <mtr><mtd style="height: 1rem"><mi>i</mi></mtd></mtr>
  188. </mtable>
  189. <mo>]</mo>
  190. </mrow>
  191. </math>,
  192. <math>
  193. <mrow>
  194. <mi>yAxis</mi>
  195. <mo>=</mo>
  196. <mo>[</mo>
  197. <mtable>
  198. <mtr><mtd style="height: 1rem"><mi>b</mi></mtd></mtr>
  199. <mtr><mtd style="height: 1rem"><mi>f</mi></mtd></mtr>
  200. <mtr><mtd style="height: 1rem"><mi>j</mi></mtd></mtr>
  201. </mtable>
  202. <mo>]</mo>
  203. </mrow>
  204. </math>, and
  205. <math>
  206. <mrow>
  207. <mi>zAxis</mi>
  208. <mo>=</mo>
  209. <mo>[</mo>
  210. <mtable>
  211. <mtr><mtd style="height: 1rem"><mi>c</mi></mtd></mtr>
  212. <mtr><mtd style="height: 1rem"><mi>g</mi></mtd></mtr>
  213. <mtr><mtd style="height: 1rem"><mi>k</mi></mtd></mtr>
  214. </mtable>
  215. <mo>]</mo>
  216. </mrow>
  217. </math>
  218. </div>
  219. <h3>[method:this extractRotation]( [param:Matrix4 m] )</h3>
  220. <p>
  221. Estrae il componente rotazione della matrice [page:Matrix4 m] fornita nel componente rotazione di questa matrice.
  222. </p>
  223. <h3>[method:this fromArray]( [param:Array array], [param:Integer offset] )</h3>
  224. <p>
  225. [page:Array array] - l'array da cui leggere gli elementi.<br />
  226. [page:Integer offset] - (opzionale) indice del primo elemento nell'array. Il valore predefinito è 0.<br /><br />
  227. Imposta gli elementi di questa matrice in base ad un array nel formato
  228. [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major].
  229. </p>
  230. <h3>[method:this invert]()</h3>
  231. <p>
  232. Inverte questa matrice, utilizzando il [link:https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution metodo analitico].
  233. Non puoi invertire con un determinante zero. Se si tenta questo, il metodo produce invece una matrice zero.
  234. </p>
  235. <h3>[method:Float getMaxScaleOnAxis]()</h3>
  236. <p>Ottiene il valore di ridimensionamento massimo dei 3 assi.</p>
  237. <h3>[method:this identity]()</h3>
  238. <p>Reimposta questa matrice alla [link:https://en.wikipedia.org/wiki/Identity_matrix matrice] identità.</p>
  239. <h3>[method:this lookAt]( [param:Vector3 eye], [param:Vector3 target], [param:Vector3 up] )</h3>
  240. <p>
  241. Costruisce una matrice di rotazione, guardando dall'[page:Vector3 occhio] verso il [page:Vector3 target] orientato dal
  242. vettore verso l'[page:Vector3 alto].
  243. </p>
  244. <h3>[method:this makeRotationAxis]( [param:Vector3 axis], [param:Float theta] )</h3>
  245. <p>
  246. [page:Vector3 axis] — Asse di rotazione, deve essere normalizzata.<br />
  247. [page:Float theta] — Angolo di rotazione in radianti.<br /><br />
  248. Imposta questa matrice come trasformazione di rotazione attorno all'[page:Vector3 asse] di [page:Float theta] radianti.<br />
  249. Questa è un'alternativa alquanto controversa ma matematicamente valida alla rotazione tramite [page:Quaternion Quaternions].
  250. Vedi la discussione [link:https://www.gamedev.net/articles/programming/math-and-physics/do-we-really-need-quaternions-r1199 qui].
  251. </p>
  252. <h3>[method:this makeBasis]( [param:Vector3 xAxis], [param:Vector3 yAxis], [param:Vector3 zAxis] )</h3>
  253. <p>
  254. Imposta questo sulla matrice di [link:https://en.wikipedia.org/wiki/Basis_(linear_algebra) base] composta dai tre
  255. vettori di base forniti:
  256. </p>
  257. <math display="block">
  258. <mrow>
  259. <mo>[</mo>
  260. <mtable>
  261. <mtr>
  262. <mtd><mi>xAxis.x</mi></mtd>
  263. <mtd><mi>yAxis.x</mi></mtd>
  264. <mtd><mi>zAxis.x</mi></mtd>
  265. <mtd><mn>0</mn></mtd>
  266. </mtr>
  267. <mtr>
  268. <mtd><mi>xAxis.y</mi></mtd>
  269. <mtd><mi>yAxis.y</mi></mtd>
  270. <mtd><mi>zAxis.y</mi></mtd>
  271. <mtd><mn>0</mn></mtd>
  272. </mtr>
  273. <mtr>
  274. <mtd><mi>xAxis.z</mi></mtd>
  275. <mtd><mi>yAxis.z</mi></mtd>
  276. <mtd><mi>zAxis.z</mi></mtd>
  277. <mtd><mn>0</mn></mtd>
  278. </mtr>
  279. <mtr>
  280. <mtd><mn>0</mn></mtd>
  281. <mtd><mn>0</mn></mtd>
  282. <mtd><mn>0</mn></mtd>
  283. <mtd><mn>1</mn></mtd>
  284. </mtr>
  285. </mtable>
  286. <mo>]</mo>
  287. </mrow>
  288. </math>
  289. <h3>[method:this makePerspective]( [param:Float left], [param:Float right], [param:Float top], [param:Float bottom], [param:Float near], [param:Float far] )</h3>
  290. <p>
  291. Crea una matrice di [link:https://en.wikipedia.org/wiki/3D_projection#Perspective_projection proiezione prospettica].
  292. Questa è utilizzata internamente da [page:PerspectiveCamera.updateProjectionMatrix]().
  293. </p>
  294. <h3>[method:this makeOrthographic]( [param:Float left], [param:Float right], [param:Float top], [param:Float bottom], [param:Float near], [param:Float far] )</h3>
  295. <p>
  296. Crea una matrice di [link:https://en.wikipedia.org/wiki/Orthographic_projection proiezione ortografica].
  297. Questa è utilizzata internamente da [page:OrthographicCamera.updateProjectionMatrix]().
  298. </p>
  299. <h3>[method:this makeRotationFromEuler]( [param:Euler euler] )</h3>
  300. <p>
  301. Imposta il componente rotazione (la matrice 3x3 in alto a sinistra) di questa matrice sulla rotazione specificata dal dato [page:Euler Angolo di Eulero].
  302. Il resto della matrice è impostato sull'identità. A seconda dell'[page:Euler.order ordine] di [page:Euler Eulero], ci sono sei possibili esisti.
  303. Vedi [link:https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix questa pagina] per una lista completa.
  304. </p>
  305. <h3>[method:this makeRotationFromQuaternion]( [param:Quaternion q] )</h3>
  306. <p>
  307. Imposta il componente rotazinoe di questa matrice alla rotazione specificata da [page:Quaternion q], come
  308. descritto [link:https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion qui].
  309. Il resto della matrice è impostato all'identità. Quindi, dato [page:Quaternion q] = w + xi + yj + zk, la matrice risultante sarà:
  310. </p>
  311. <math display="block">
  312. <mrow>
  313. <mo>[</mo>
  314. <mtable>
  315. <mtr>
  316. <mtd>
  317. <mn>1</mn>
  318. <mo>-</mo>
  319. <mn>2</mn>
  320. <msup>
  321. <mi>y</mi>
  322. <mn>2</mn>
  323. </msup>
  324. <mo>-</mo>
  325. <mn>2</mn>
  326. <msup>
  327. <mi>z</mi>
  328. <mn>2</mn>
  329. </msup>
  330. </mtd>
  331. <mtd>
  332. <mn>2</mn>
  333. <mi>x</mi>
  334. <mi>y</mi>
  335. <mo>-</mo>
  336. <mn>2</mn>
  337. <mi>z</mi>
  338. <mi>w</mi>
  339. </mtd>
  340. <mtd>
  341. <mn>2</mn>
  342. <mi>x</mi>
  343. <mi>z</mi>
  344. <mo>+</mo>
  345. <mn>2</mn>
  346. <mi>y</mi>
  347. <mi>w</mi>
  348. </mtd>
  349. <mtd>
  350. <mn>0</mn>
  351. </mtd>
  352. </mtr>
  353. <mtr>
  354. <mtd>
  355. <mn>2</mn>
  356. <mi>x</mi>
  357. <mi>y</mi>
  358. <mo>+</mo>
  359. <mn>2</mn>
  360. <mi>z</mi>
  361. <mi>w</mi>
  362. </mtd>
  363. <mtd>
  364. <mn>1</mn>
  365. <mo>-</mo>
  366. <mn>2</mn>
  367. <msup>
  368. <mi>x</mi>
  369. <mn>2</mn>
  370. </msup>
  371. <mo>-</mo>
  372. <mn>2</mn>
  373. <msup>
  374. <mi>z</mi>
  375. <mn>2</mn>
  376. </msup>
  377. </mtd>
  378. <mtd>
  379. <mn>2</mn>
  380. <mi>y</mi>
  381. <mi>z</mi>
  382. <mo>-</mo>
  383. <mn>2</mn>
  384. <mi>x</mi>
  385. <mi>w</mi>
  386. </mtd>
  387. <mtd>
  388. <mn>0</mn>
  389. </mtd>
  390. </mtr>
  391. <mtr>
  392. <mtd>
  393. <mn>2</mn>
  394. <mi>x</mi>
  395. <mi>z</mi>
  396. <mo>-</mo>
  397. <mn>2</mn>
  398. <mi>y</mi>
  399. <mi>w</mi>
  400. </mtd>
  401. <mtd>
  402. <mn>2</mn>
  403. <mi>y</mi>
  404. <mi>z</mi>
  405. <mo>+</mo>
  406. <mn>2</mn>
  407. <mi>x</mi>
  408. <mi>w</mi>
  409. </mtd>
  410. <mtd>
  411. <mn>1</mn>
  412. <mo>-</mo>
  413. <mn>2</mn>
  414. <msup>
  415. <mi>x</mi>
  416. <mn>2</mn>
  417. </msup>
  418. <mo>-</mo>
  419. <mn>2</mn>
  420. <msup>
  421. <mi>y</mi>
  422. <mn>2</mn>
  423. </msup>
  424. </mtd>
  425. <mtd>
  426. <mn>0</mn>
  427. </mtd>
  428. </mtr>
  429. <mtr>
  430. <mtd><mn>0</mn></mtd>
  431. <mtd><mn>0</mn></mtd>
  432. <mtd><mn>0</mn></mtd>
  433. <mtd><mn>1</mn></mtd>
  434. </mtr>
  435. </mtable>
  436. <mo>]</mo>
  437. </mrow>
  438. </math>
  439. <h3>[method:this makeRotationX]( [param:Float theta] )</h3>
  440. <p>
  441. [page:Float theta] — Angolo rotazione in radianti.<br /><br />
  442. Imposta questa matrice come una trasformazione rotazionale attorno all'asse X in radianti theta [page:Float theta] (&theta;).
  443. La matrice risultante sarà:
  444. </p>
  445. <math display="block">
  446. <mrow>
  447. <mo>[</mo>
  448. <mtable>
  449. <mtr>
  450. <mtd><mn>1</mn></mtd>
  451. <mtd><mn>0</mn></mtd>
  452. <mtd><mn>0</mn></mtd>
  453. <mtd><mn>0</mn></mtd>
  454. </mtr>
  455. <mtr>
  456. <mtd>
  457. <mn>0</mn>
  458. </mtd>
  459. <mtd>
  460. <mi>cos</mi>
  461. <mi>&theta;</mi>
  462. </mtd>
  463. <mtd>
  464. <mo>-</mo>
  465. <mi>sin</mi>
  466. <mi>&theta;</mi>
  467. </mtd>
  468. <mtd>
  469. <mn>0</mn>
  470. </mtd>
  471. </mtr>
  472. <mtr>
  473. <mtd>
  474. <mn>0</mn>
  475. </mtd>
  476. <mtd>
  477. <mi>sin</mi>
  478. <mi>&theta;</mi>
  479. </mtd>
  480. <mtd>
  481. <mi>cos</mi>
  482. <mi>&theta;</mi>
  483. </mtd>
  484. <mtd>
  485. <mn>0</mn>
  486. </mtd>
  487. </mtr>
  488. <mtr>
  489. <mtd><mn>0</mn></mtd>
  490. <mtd><mn>0</mn></mtd>
  491. <mtd><mn>0</mn></mtd>
  492. <mtd><mn>1</mn></mtd>
  493. </mtr>
  494. </mtable>
  495. <mo>]</mo>
  496. </mrow>
  497. </math>
  498. <h3>[method:this makeRotationY]( [param:Float theta] )</h3>
  499. <p>
  500. [page:Float theta] — Angolo rotazione in radianti.<br /><br />
  501. Imposta questa matrice come una trasformazione rotazionale attorno all'asse Y in radianti theta [page:Float theta] (&theta;).
  502. La matrice risultante sarà:
  503. </p>
  504. <math display="block">
  505. <mrow>
  506. <mo>[</mo>
  507. <mtable>
  508. <mtr>
  509. <mtd>
  510. <mi>cos</mi>
  511. <mi>&theta;</mi>
  512. </mtd>
  513. <mtd>
  514. <mn>0</mn>
  515. </mtd>
  516. <mtd>
  517. <mi>sin</mi>
  518. <mi>&theta;</mi>
  519. </mtd>
  520. <mtd>
  521. <mn>0</mn>
  522. </mtd>
  523. </mtr>
  524. <mtr>
  525. <mtd><mn>0</mn></mtd>
  526. <mtd><mn>1</mn></mtd>
  527. <mtd><mn>0</mn></mtd>
  528. <mtd><mn>0</mn></mtd>
  529. </mtr>
  530. <mtr>
  531. <mtd>
  532. <mo>-</mo>
  533. <mi>sin</mi>
  534. <mi>&theta;</mi>
  535. </mtd>
  536. <mtd>
  537. <mn>0</mn>
  538. </mtd>
  539. <mtd>
  540. <mi>cos</mi>
  541. <mi>&theta;</mi>
  542. </mtd>
  543. <mtd>
  544. <mn>0</mn>
  545. </mtd>
  546. </mtr>
  547. <mtr>
  548. <mtd><mn>0</mn></mtd>
  549. <mtd><mn>0</mn></mtd>
  550. <mtd><mn>0</mn></mtd>
  551. <mtd><mn>1</mn></mtd>
  552. </mtr>
  553. </mtable>
  554. <mo>]</mo>
  555. </mrow>
  556. </math>
  557. <h3>[method:this makeRotationZ]( [param:Float theta] )</h3>
  558. <p>
  559. [page:Float theta] — Angolo rotazione in radianti.<br /><br />
  560. Imposta questa matrice come una trasformazione rotazionale attorno all'asse Z in radianti theta [page:Float theta] (&theta;).
  561. La matrice risultante sarà:
  562. </p>
  563. <math display="block">
  564. <mrow>
  565. <mo>[</mo>
  566. <mtable>
  567. <mtr>
  568. <mtd>
  569. <mi>cos</mi>
  570. <mi>&theta;</mi>
  571. </mtd>
  572. <mtd>
  573. <mo>-</mo>
  574. <mi>sin</mi>
  575. <mi>&theta;</mi>
  576. </mtd>
  577. <mtd>
  578. <mn>0</mn>
  579. </mtd>
  580. <mtd>
  581. <mn>0</mn>
  582. </mtd>
  583. </mtr>
  584. <mtr>
  585. <mtd>
  586. <mi>sin</mi>
  587. <mi>&theta;</mi>
  588. </mtd>
  589. <mtd>
  590. <mi>cos</mi>
  591. <mi>&theta;</mi>
  592. </mtd>
  593. <mtd>
  594. <mn>0</mn>
  595. </mtd>
  596. <mtd>
  597. <mn>0</mn>
  598. </mtd>
  599. </mtr>
  600. <mtr>
  601. <mtd><mn>0</mn></mtd>
  602. <mtd><mn>0</mn></mtd>
  603. <mtd><mn>1</mn></mtd>
  604. <mtd><mn>0</mn></mtd>
  605. </mtr>
  606. <mtr>
  607. <mtd><mn>0</mn></mtd>
  608. <mtd><mn>0</mn></mtd>
  609. <mtd><mn>0</mn></mtd>
  610. <mtd><mn>1</mn></mtd>
  611. </mtr>
  612. </mtable>
  613. <mo>]</mo>
  614. </mrow>
  615. </math>
  616. <h3>[method:this makeScale]( [param:Float x], [param:Float y], [param:Float z] )</h3>
  617. <p>
  618. [page:Float x] - la quantità da scalare sull'asse X.<br />
  619. [page:Float y] - la quantità da scalare sull'asse Y.<br />
  620. [page:Float z] - la quantità da scalare sull'asse Z.<br /><br />
  621. Imposta questa matrice come trasformazione di scala:
  622. </p>
  623. <math display="block">
  624. <mrow>
  625. <mo>[</mo>
  626. <mtable>
  627. <mtr>
  628. <mtd><mi>x</mi></mtd>
  629. <mtd><mn>0</mn></mtd>
  630. <mtd><mn>0</mn></mtd>
  631. <mtd><mn>0</mn></mtd>
  632. </mtr>
  633. <mtr>
  634. <mtd><mn>0</mn></mtd>
  635. <mtd><mi>y</mi></mtd>
  636. <mtd><mn>0</mn></mtd>
  637. <mtd><mn>0</mn></mtd>
  638. </mtr>
  639. <mtr>
  640. <mtd><mn>0</mn></mtd>
  641. <mtd><mn>0</mn></mtd>
  642. <mtd><mi>z</mi></mtd>
  643. <mtd><mn>0</mn></mtd>
  644. </mtr>
  645. <mtr>
  646. <mtd><mn>0</mn></mtd>
  647. <mtd><mn>0</mn></mtd>
  648. <mtd><mn>0</mn></mtd>
  649. <mtd><mn>1</mn></mtd>
  650. </mtr>
  651. </mtable>
  652. <mo>]</mo>
  653. </mrow>
  654. </math>
  655. <h3>[method:this makeShear]( [param:Float xy], [param:Float xz], [param:Float yx], [param:Float yz], [param:Float zx], [param:Float zy] )</h3>
  656. <p>
  657. [page:Float xy] - la quantità di taglio di X per Y.<br />
  658. [page:Float xz] - la quantità di taglio di X per Z.<br />
  659. [page:Float yx] - la quantità di taglio di Y per X.<br />
  660. [page:Float yz] - la quantità di taglio di Y per Z.<br />
  661. [page:Float zx] - la quantità di taglio di Z per X.<br />
  662. [page:Float zy] - la quantità di taglio di Z per Y.<br /><br />
  663. Imposta questa matrice come trasformata di taglio:
  664. </p>
  665. <math display="block">
  666. <mrow>
  667. <mo>[</mo>
  668. <mtable>
  669. <mtr>
  670. <mtd><mn>1</mn></mtd>
  671. <mtd><mi>y</mi><mi>x</mi></mtd>
  672. <mtd><mi>z</mi><mi>x</mi></mtd>
  673. <mtd><mn>0</mn></mtd>
  674. </mtr>
  675. <mtr>
  676. <mtd><mi>x</mi><mi>y</mi></mtd>
  677. <mtd><mn>1</mn></mtd>
  678. <mtd><mi>z</mi><mi>y</mi></mtd>
  679. <mtd><mn>0</mn></mtd>
  680. </mtr>
  681. <mtr>
  682. <mtd><mi>x</mi><mi>z</mi></mtd>
  683. <mtd><mi>y</mi><mi>z</mi></mtd>
  684. <mtd><mn>1</mn></mtd>
  685. <mtd><mn>0</mn></mtd>
  686. </mtr>
  687. <mtr>
  688. <mtd><mn>0</mn></mtd>
  689. <mtd><mn>0</mn></mtd>
  690. <mtd><mn>0</mn></mtd>
  691. <mtd><mn>1</mn></mtd>
  692. </mtr>
  693. </mtable>
  694. <mo>]</mo>
  695. </mrow>
  696. </math>
  697. <h3>[method:this makeTranslation]( [param:Vector3 v] )</h3>
  698. <h3>
  699. [method:this makeTranslation]( [param:Float x], [param:Float y], [param:Float z] ) // optional API
  700. </h3>
  701. <p>
  702. Imposta questa matrice come una trasformata di traslazione dal vettore [page:Vector3 v]:
  703. </p>
  704. <math display="block">
  705. <mrow>
  706. <mo>[</mo>
  707. <mtable>
  708. <mtr>
  709. <mtd><mn>1</mn></mtd>
  710. <mtd><mn>0</mn></mtd>
  711. <mtd><mn>0</mn></mtd>
  712. <mtd><mi>x</mi></mtd>
  713. </mtr>
  714. <mtr>
  715. <mtd><mn>0</mn></mtd>
  716. <mtd><mn>1</mn></mtd>
  717. <mtd><mn>0</mn></mtd>
  718. <mtd><mi>y</mi></mtd>
  719. </mtr>
  720. <mtr>
  721. <mtd><mn>0</mn></mtd>
  722. <mtd><mn>0</mn></mtd>
  723. <mtd><mn>1</mn></mtd>
  724. <mtd><mi>z</mi></mtd>
  725. </mtr>
  726. <mtr>
  727. <mtd><mn>0</mn></mtd>
  728. <mtd><mn>0</mn></mtd>
  729. <mtd><mn>0</mn></mtd>
  730. <mtd><mn>1</mn></mtd>
  731. </mtr>
  732. </mtable>
  733. <mo>]</mo>
  734. </mrow>
  735. </math>
  736. <h3>[method:this multiply]( [param:Matrix4 m] )</h3>
  737. <p>Post-moltiplica questa matrice per [page:Matrix4 m].</p>
  738. <h3>[method:this multiplyMatrices]( [param:Matrix4 a], [param:Matrix4 b] )</h3>
  739. <p>Imposta questa matrice a [page:Matrix4 a] x [page:Matrix4 b].</p>
  740. <h3>[method:this multiplyScalar]( [param:Float s] )</h3>
  741. <p>Moltiplica ogni componente della matrice per il valore scalare [page:Float s].</p>
  742. <h3>[method:this premultiply]( [param:Matrix4 m] )</h3>
  743. <p>Pre-moltiplica questa matrice per [page:Matrix4 m].</p>
  744. <h3>[method:this scale]( [param:Vector3 v] )</h3>
  745. <p>Moltiplica le colonne di questa matrice per il vettore [page:Vector3 v].</p>
  746. <h3>[method:this set]( [param:Float n11], [param:Float n12], [param:Float n13], [param:Float n14], [param:Float n21], [param:Float n22], [param:Float n23], [param:Float n24], [param:Float n31], [param:Float n32], [param:Float n33], [param:Float n34], [param:Float n41], [param:Float n42], [param:Float n43], [param:Float n44] )</h3>
  747. <p>
  748. Imposta gli [page:.elements elementi] di questa matrice ai valori principali di row-major forniti [page:Float n11],
  749. [page:Float n12], ... [page:Float n44].
  750. </p>
  751. <h3>[method:this setFromMatrix3]( [param:Matrix3 m] )</h3>
  752. <p>Imposta gli elementi 3x3 superiori di questa matrice sui valori di Matrix3 [page:Matrix3 m].</p>
  753. <h3>[method:this setPosition]( [param:Vector3 v] )</h3>
  754. <h3>[method:this setPosition]( [param:Float x], [param:Float y], [param:Float z] ) // optional API</h3>
  755. <p>
  756. Imposta la componente posizione per questa matrice dal vettore [page:Vector3 v], senza influenzare
  757. il resto della matrice - ovvero se la matrice è attulmente:
  758. </p>
  759. <math display="block">
  760. <mrow>
  761. <mo>[</mo>
  762. <mtable>
  763. <mtr>
  764. <mtd><mi>a</mi></mtd>
  765. <mtd><mi>b</mi></mtd>
  766. <mtd><mi>c</mi></mtd>
  767. <mtd><mi>d</mi></mtd>
  768. </mtr>
  769. <mtr>
  770. <mtd><mi>e</mi></mtd>
  771. <mtd><mi>f</mi></mtd>
  772. <mtd><mi>g</mi></mtd>
  773. <mtd><mi>h</mi></mtd>
  774. </mtr>
  775. <mtr>
  776. <mtd><mi>i</mi></mtd>
  777. <mtd><mi>j</mi></mtd>
  778. <mtd><mi>k</mi></mtd>
  779. <mtd><mi>l</mi></mtd>
  780. </mtr>
  781. <mtr>
  782. <mtd><mi>m</mi></mtd>
  783. <mtd><mi>n</mi></mtd>
  784. <mtd><mi>o</mi></mtd>
  785. <mtd><mi>p</mi></mtd>
  786. </mtr>
  787. </mtable>
  788. <mo>]</mo>
  789. </mrow>
  790. </math>
  791. <p>Questa diventa:</p>
  792. <math display="block">
  793. <mrow>
  794. <mo>[</mo>
  795. <mtable>
  796. <mtr>
  797. <mtd><mi>a</mi></mtd>
  798. <mtd><mi>b</mi></mtd>
  799. <mtd><mi>c</mi></mtd>
  800. <mtd><mi>v.x</mi></mtd>
  801. </mtr>
  802. <mtr>
  803. <mtd><mi>e</mi></mtd>
  804. <mtd><mi>f</mi></mtd>
  805. <mtd><mi>g</mi></mtd>
  806. <mtd><mi>v.y</mi></mtd>
  807. </mtr>
  808. <mtr>
  809. <mtd><mi>i</mi></mtd>
  810. <mtd><mi>j</mi></mtd>
  811. <mtd><mi>k</mi></mtd>
  812. <mtd><mi>v.z</mi></mtd>
  813. </mtr>
  814. <mtr>
  815. <mtd><mi>m</mi></mtd>
  816. <mtd><mi>n</mi></mtd>
  817. <mtd><mi>o</mi></mtd>
  818. <mtd><mi>p</mi></mtd>
  819. </mtr>
  820. </mtable>
  821. <mo>]</mo>
  822. </mrow>
  823. </math>
  824. <h3>[method:Array toArray]( [param:Array array], [param:Integer offset] )</h3>
  825. <p>
  826. [page:Array array] - (opzionale) array per memorizzare il vettore risultante.<br />
  827. [page:Integer offset] - (opzionale) offset nell'array in cui inserire il risultato.<br /><br />
  828. Scrive gli elementi di questa matrice in una matrice in formato
  829. [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major].
  830. </p>
  831. <h3>[method:this transpose]()</h3>
  832. <p>[link:https://en.wikipedia.org/wiki/Transpose Traspone] questa matrice.</p>
  833. <h2>Source</h2>
  834. <p>
  835. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  836. </p>
  837. </body>
  838. </html>