Matrix3.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. <h1>[name]</h1>
  12. <div class="desc">
  13. A class representing a 3x3 [link:https://en.wikipedia.org/wiki/Matrix_(mathematics) matrix].
  14. </div>
  15. <h2>Example</h2>
  16. <code>
  17. var m = new Matrix3();
  18. m.set( 11, 12, 13,
  19. 21, 22, 23,
  20. 31, 32, 33 );
  21. </code>
  22. <h2>Constructor</h2>
  23. <h3>[name]()</h3>
  24. <div>
  25. Creates and initializes the [name] to the 3x3
  26. [link:https://en.wikipedia.org/wiki/Identity_matrix identity matrix].
  27. </div>
  28. <h2>Properties</h2>
  29. <h3>[property:Float32Array elements]</h3>
  30. <div>
  31. A [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major]
  32. list of matrix values.
  33. </div>
  34. <h3>[property:Boolean isMatrix3]</h3>
  35. <div>
  36. Used to check whether this or derived classes are Matrix3s. Default is *true*.<br /><br />
  37. You should not change this, as it used internally for optimisation.
  38. </div>
  39. <h2>Methods</h2>
  40. <h3>[method:Array applyToBuffer]( [page:ArrayBuffer buffer], [page:Number offset], [page:Number length] )</h3>
  41. <div>
  42. [page:Array buffer] - An [link:https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer ArrayBuffer]
  43. of floats in the form [vector1x, vector1y, vector1z, vector2x, vector2y, vector2z, ...], that represent 3D vectors.<br />>
  44. [page:Number offset] - (optional) index in the array of the first vector's x component. Default is 0.<br />
  45. [page:Number length] - (optional) index in the array of the last vector's z component.
  46. Default is the last element in the array.<br /><br />
  47. Multiplies (applies) this matrix to every 3D vector in the [page:ArrayBuffer buffer].
  48. </div>
  49. <h3>[method:Array applyToVector3Array]( [page:Array array], [page:Number offset], [page:Number length] )</h3>
  50. <div>
  51. [page:Array array] - An array of floats in the form [vector1x, vector1y, vector1z, vector2x, vector2y, vector2z, ...],
  52. that represent 3D vectors.<br />>
  53. [page:Number offset] - (optional) index in the array of the first vector's x component. Default is 0.<br />
  54. [page:Number length] - (optional) index in the array of the last vector's z component.
  55. Default is the last element in the array.<br /><br />
  56. Multiplies (applies) this matrix to every 3D vector in the [page:Array array].
  57. </div>
  58. <h3>[method:Matrix3 clone]()</h3>
  59. <div>Creates a new Matrix3 and with identical elements to this one.</div>
  60. <h3>[method:Matrix3 copy]( [page:Matrix3 m] )</h3>
  61. <div>Copies the elements of matrix [page:Matrix3 m] into this matrix.</div>
  62. <h3>[method:Float determinant]()</h3>
  63. <div>
  64. Computes and returns the [link:https://en.wikipedia.org/wiki/Determinant determinant] of this matrix.
  65. </div>
  66. <h3>[method:Matrix3 fromArray]( [page:Array array], [page:Integer offset] )</h3>
  67. <div>
  68. [page:Array array] - the array to read the elements from.<br />
  69. [page:Integer offset] - (optional) index of first element in the array. Default is 0.<br /><br />
  70. Sets the elements of this matrix based on an array in
  71. [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format.
  72. </div>
  73. <h3>[method:Matrix3 getInverse]( [page:Matrix3 m], [page:Boolean throwOnDegenerate] )</h3>
  74. <div>
  75. [page:Matrix3 m] - the matrix to take the inverse of.<br />
  76. [page:Boolean throwOnDegenerate] - (optional) If true, throw an error if the matrix is degenerate (not invertible).<br /><br />
  77. Set this matrix to the [link:https://en.wikipedia.org/wiki/Invertible_matrix inverse] of the passed matrix [page:Matrix3 m],
  78. using the [link:https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution analytic method].
  79. If [page:Boolean throwOnDegenerate] is not set and the matrix is invertible, return the 3x3 identity matrix.
  80. </div>
  81. <h3>[method:Matrix3 getNormalMatrix]( [page:Matrix4 m] )</h3>
  82. <div>
  83. [page:Matrix4 m] - [page:Matrix4]<br /><br />
  84. Sets this matrix as the upper left 3x3 of the [link:https://en.wikipedia.org/wiki/Normal_matrix normal matrix]
  85. of the passed [page:Matrix4 matrix4]. The normal matrix is the [link:https://en.wikipedia.org/wiki/Invertible_matrix inverse] [link:https://en.wikipedia.org/wiki/Transpose transpose]
  86. of the matrix [page:Matrix4 m].
  87. </div>
  88. <h3>[method:Matrix3 identity]()</h3>
  89. <div>
  90. Resets this matrix to the 3x3 identity matrix.<br/><br/>
  91. 1, 0, 0<br/>
  92. 0, 1, 0<br/>
  93. 0, 0, 1<br/>
  94. </div>
  95. <h3>[method:Matrix3 multiplyScalar]( [page:Float s] )</h3>
  96. <div>Multiplies every component of the matrix by the scalar value *s*.</div>
  97. <h3>
  98. [method:Matrix3 set](
  99. [page:Float n11], [page:Float n12], [page:Float n13],
  100. [page:Float n21], [page:Float n22], [page:Float n23],
  101. [page:Float n31], [page:Float n32], [page:Float n33] )
  102. </h3>
  103. <div>
  104. [page:Float n11] - value to put in row 1, col 1.<br />
  105. [page:Float n12] - value to put in row 1, col 2.<br />
  106. [page:Float n13] - value to put in row 1, col 3.<br />
  107. [page:Float n21] - value to put in row 2, col 1.<br />
  108. [page:Float n22] - value to put in row 2, col 2.<br />
  109. [page:Float n23] - value to put in row 2, col 3.<br />
  110. [page:Float n31] - value to put in row 3, col 1.<br />
  111. [page:Float n32] - value to put in row 3, col 2.<br />
  112. [page:Float n33] - value to put in row 3, col 3.<br /><br />
  113. Sets the 3x3 matrix values to the given [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order row-major]
  114. sequence of values.
  115. </div>
  116. <h3>[method:Matrix3 setFromMatrix4]( [page:Matrix4 m] )</h3>
  117. <div>Set this matrx to the upper 3x3 matrix of the Matrix4 [page:Matrix4 m].</div>
  118. <h3>[method:Array toArray]( [page:Array array], [page:Integer offset] )</h3>
  119. <div>
  120. [page:Array array] - (optional) array to store the resulting vector in.<br />
  121. [page:Integer offset] - (optional) offset in the array at which to put the result.<br /><br />
  122. Writes the elements of this matrix to an array in
  123. [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format.
  124. </div>
  125. <h3>[method:Matrix3 transpose]()</h3>
  126. <div>[linkLhttps://en.wikipedia.org/wiki/Transpose Transposes] this matrix in place.</div>
  127. <h3>[method:Matrix3 transposeIntoArray]( [page:Array array] )</h3>
  128. <div>
  129. [page:Array array] - array to store the resulting vector in.<br /><br />
  130. [linkLhttps://en.wikipedia.org/wiki/Transpose Transposes] this matrix into the supplied array,
  131. and returns itself unchanged.
  132. </div>
  133. <h2>Source</h2>
  134. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  135. </body>
  136. </html>