We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I already asked this question in the hardware section while announcing my Oculus Rift solution:
How do i invert the x-axis of a 4x4 matrix before applying it to the sketch via applyMatrix()?
Any idea? I haven't found a simple solution in Processing yet. Next i'll have a look at javax.vecmath.Matrix4f.
Answers
Dunno, but I'm gonna risk an attempt answer ->
scale(-1, 0);
:-SSAssuming your 4x4 matrix is in this form:
Rx1, Rx2, Rx3, x
Ry1, Ry2, Ry3, y
Rz1, Rz2, Rz3, z
0.0, 0.0, 0.0, 1.0
You would need to multiply the top right element by -1. This would probably be element [3] if it is a single dimension array representation or element [0][3] if it is a double array.
If it is being done with matrix multiplication this would do it:
-1, 0, 0, 0
0, 1, 0, 0
0, 0, 1, 0
0, 0, 0, 1
Like @GoToLoop wrote, using scale(-1.0, 1.0) will invert the x-axis and produce the following matrix:
You can also multiply the matrix "by hand", like @asimes mentioned, using applyMatrix():
A little example - without the scale() call the arrow would be facing right:
Thanks for the answers! I'll implement it next week and hopefully publish the Oculus Rift code.
No problem. Would love to see your Code! And don't forget to mark the correct answer/answers. It will help others to find the solution more quickly. ;)