I was working on a bit of software that should show a vector (3D) on the screen while I can choose the rotation of it.
So I thought: Rotate around each of the axis with the angles, then project it (just cut off the last line of the vector).
This is my code:
P1 = [ [cos(p),sin(p),0], [-sin(p),cos(p),0], [0,0,1] ] P2 = [ [1,0,0], [0,cos(t),sin(t)], [0,-sin(t),cos(t)], ] P3 = [ [cos(x),0,sin(x)], [0,1,0], [-sin(x),0,cos(x)], ] return mmult(mmult(P3,mmult(P2,P1)),v)
p stands for phi, t for theta, and x for … just x. Or xi.
Recent Comments