* Applies a matrix to a vector with x, y, z, w components and returns the result as an array. * * This method multiplies the current matrix by a 4D vector (x, y, z, w) and computes the resulting vector. * It is commonly used in 3D graphics for transformations such as translation, rotation,
(x, y, z, w)
| 1381 | * } |
| 1382 | */ |
| 1383 | multiplyVec4(x, y, z, w) { |
| 1384 | const result = new Array(4); |
| 1385 | const m = this.matrix; |
| 1386 | |
| 1387 | result[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; |
| 1388 | result[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; |
| 1389 | result[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; |
| 1390 | result[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; |
| 1391 | |
| 1392 | return result; |
| 1393 | } |
| 1394 | |
| 1395 | /** |
| 1396 | * Applies a matrix to a vector. The fourth component is set to 1. |
no outgoing calls
no test coverage detected