Apply a translation to this matrix by translating by the given number of units in x, y and z. If M is this matrix and T the translation matrix, then the new current matrix will be M T . So when transforming a vector v with the new m
(double x, double y, double z)
| 2308 | * @see #translation(double, double, double) |
| 2309 | */ |
| 2310 | public Mat4 translate(double x, double y, double z) { |
| 2311 | // translation matrix elements: |
| 2312 | // m00, m11, m22, m33 = 1 |
| 2313 | // m30 = x, m31 = y, m32 = z |
| 2314 | // all others = 0 |
| 2315 | m30 = m00 * x + m10 * y + m20 * z + m30; |
| 2316 | m31 = m01 * x + m11 * y + m21 * z + m31; |
| 2317 | m32 = m02 * x + m12 * y + m22 * z + m32; |
| 2318 | m33 = m03 * x + m13 * y + m23 * z + m33; |
| 2319 | return this; |
| 2320 | } |
| 2321 | |
| 2322 | /** |
| 2323 | * Apply a translation to this matrix by translating by the given number of units in x, y and z. |