* Translates the current matrix by a given vector. * * This method applies a translation transformation to the current matrix. * Translation moves the matrix by a specified amount along the x, y, and z axes. * The input vector can be a 2D or 3D vector. If the z-component is not provided,
(v)
| 1099 | * } |
| 1100 | */ |
| 1101 | translate(v) { |
| 1102 | const x = v[0], |
| 1103 | y = v[1], |
| 1104 | z = v[2] || 0; |
| 1105 | this.matrix[12] += |
| 1106 | this.matrix[0] * x + this.matrix[4] * y + this.matrix[8] * z; |
| 1107 | this.matrix[13] += |
| 1108 | this.matrix[1] * x + this.matrix[5] * y + this.matrix[9] * z; |
| 1109 | this.matrix[14] += |
| 1110 | this.matrix[2] * x + this.matrix[6] * y + this.matrix[10] * z; |
| 1111 | this.matrix[15] += |
| 1112 | this.matrix[3] * x + this.matrix[7] * y + this.matrix[11] * z; |
| 1113 | return this; |
| 1114 | } |
| 1115 | |
| 1116 | /** |
| 1117 | * Rotates the matrix around the X-axis by a given angle. |
no outgoing calls
no test coverage detected