Skip to content
Forum Archive

How do I rotate somthing on the y-axis?

4 posts

UnConeD#
3D?

If you mean 3D, the formula is (in matrixform):

[ x' ]   [ c  0 s 0 ] [ x ]
[ y' ] = [ 0  1 0 0 ] [ y ]
[ z' ]   [ -s 0 c 0 ] [ z ]
[ 1  ]   [ 0  0 0 1 ] [ 1 ]


With c and s being the cosine and sine of the angle to rotate.
If you don't know matrixmath, the formula above expands into:

x' = c*x + s*z;
y' = y;
z' = -s*x + c*z;
deathazre#
Re: 3D?

Originally posted by UnConeD
If you mean 3D, the formula is (in matrixform):

[ x' ]   [ c  0 s 0 ] [ x ]
[ y' ] = [ 0  1 0 0 ] [ y ]
[ z' ]   [ -s 0 c 0 ] [ z ]
[ 1  ]   [ 0  0 0 1 ] [ 1 ]

take off the 4th rows and columns 😛
UnConeD#
I used homogenous coordinates which are more common in 3D because you can write any transformation with them... (e.g. translation is a 4x4 with the last column being the 3 coordinates of the new origin and a 1.) The last coordinate should probably be t' and t, but I wrote 1 to show that it's of no significance here.