Matrix3.html 6.8 KB

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