Matrix3.d.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. import { Matrix4 } from './Matrix4';
  2. import { Vector3 } from './Vector3';
  3. type Matrix3Tuple = [
  4. number, number, number,
  5. number, number, number,
  6. number, number, number,
  7. ];
  8. /**
  9. * ( interface Matrix<T> )
  10. */
  11. export interface Matrix {
  12. /**
  13. * Array with matrix values.
  14. */
  15. elements: number[];
  16. /**
  17. * identity():T;
  18. */
  19. identity(): Matrix;
  20. /**
  21. * copy(m:T):T;
  22. */
  23. copy( m: this ): this;
  24. /**
  25. * multiplyScalar(s:number):T;
  26. */
  27. multiplyScalar( s: number ): Matrix;
  28. determinant(): number;
  29. /**
  30. * transpose():T;
  31. */
  32. transpose(): Matrix;
  33. /**
  34. * invert():T;
  35. */
  36. invert(): Matrix;
  37. /**
  38. * clone():T;
  39. */
  40. clone(): this;
  41. }
  42. /**
  43. * ( class Matrix3 implements Matrix<Matrix3> )
  44. */
  45. export class Matrix3 implements Matrix {
  46. /**
  47. * Creates an identity matrix.
  48. */
  49. constructor();
  50. /**
  51. * Array with matrix values.
  52. * @default [1, 0, 0, 0, 1, 0, 0, 0, 1]
  53. */
  54. elements: number[];
  55. set(
  56. n11: number,
  57. n12: number,
  58. n13: number,
  59. n21: number,
  60. n22: number,
  61. n23: number,
  62. n31: number,
  63. n32: number,
  64. n33: number
  65. ): Matrix3;
  66. identity(): Matrix3;
  67. clone(): this;
  68. copy( m: Matrix3 ): this;
  69. extractBasis( xAxis: Vector3, yAxis: Vector3, zAxis: Vector3 ): Matrix3;
  70. setFromMatrix4( m: Matrix4 ): Matrix3;
  71. multiplyScalar( s: number ): Matrix3;
  72. determinant(): number;
  73. /**
  74. * Inverts this matrix in place.
  75. */
  76. invert(): Matrix3;
  77. /**
  78. * Transposes this matrix in place.
  79. */
  80. transpose(): Matrix3;
  81. getNormalMatrix( matrix4: Matrix4 ): Matrix3;
  82. /**
  83. * Transposes this matrix into the supplied array r, and returns itself.
  84. */
  85. transposeIntoArray( r: number[] ): Matrix3;
  86. setUvTransform( tx: number, ty: number, sx: number, sy: number, rotation: number, cx: number, cy: number ): Matrix3;
  87. scale( sx: number, sy: number ): Matrix3;
  88. rotate( theta: number ): Matrix3;
  89. translate( tx: number, ty: number ): Matrix3;
  90. equals( matrix: Matrix3 ): boolean;
  91. /**
  92. * Sets the values of this matrix from the provided array.
  93. * @param array the source array.
  94. * @param offset (optional) offset into the array. Default is 0.
  95. */
  96. fromArray( array: number[], offset?: number ): Matrix3;
  97. /**
  98. * Sets the values of this matrix from the provided array-like.
  99. * @param array the source array-like.
  100. * @param offset (optional) offset into the array-like. Default is 0.
  101. */
  102. fromArray( array: ArrayLike<number>, offset?: number ): Matrix3;
  103. /**
  104. * Returns an array with the values of this matrix, or copies them into the provided array.
  105. * @param array (optional) array to store the matrix to. If this is not provided, a new array will be created.
  106. * @param offset (optional) optional offset into the array.
  107. * @return The created or provided array.
  108. */
  109. toArray( array?: number[], offset?: number ): number[];
  110. toArray( array?: Matrix3Tuple, offset?: 0 ): Matrix3Tuple;
  111. /**
  112. * Copies he values of this matrix into the provided array-like.
  113. * @param array array-like to store the matrix to.
  114. * @param offset (optional) optional offset into the array-like.
  115. * @return The provided array-like.
  116. */
  117. toArray( array?: ArrayLike<number>, offset?: number ): ArrayLike<number>;
  118. /**
  119. * Multiplies this matrix by m.
  120. */
  121. multiply( m: Matrix3 ): Matrix3;
  122. premultiply( m: Matrix3 ): Matrix3;
  123. /**
  124. * Sets this matrix to a x b.
  125. */
  126. multiplyMatrices( a: Matrix3, b: Matrix3 ): Matrix3;
  127. /**
  128. * @deprecated Use {@link Vector3.applyMatrix3 vector.applyMatrix3( matrix )} instead.
  129. */
  130. multiplyVector3( vector: Vector3 ): any;
  131. /**
  132. * @deprecated This method has been removed completely.
  133. */
  134. multiplyVector3Array( a: any ): any;
  135. getInverse( matrix: Matrix4, throwOnDegenerate?: boolean ): Matrix3;
  136. /**
  137. * @deprecated Use {@link Matrix3#toArray .toArray()} instead.
  138. */
  139. flattenToArrayOffset( array: number[], offset: number ): number[];
  140. /**
  141. * @deprecated Use {@link Matrix3#invert .invert()} instead.
  142. */
  143. getInverse( matrix: Matrix ): Matrix;
  144. }
粤ICP备19079148号