# Rotation of a point in 3D space

I want to rotate a point (3,4,5) by an angle 45 degrees(0.785398 rad) in 3D space. I have used the standard DCM matrix in the order Rx, Ry and Rz. Where, theta = 0.785398, Rx= ( [ 1, 0, 0] [ 0, cos(theta), sin(theta)] [ 0, -sin(theta), cos(theta)])

Ry= ([ cos(theta), 0, -sin(theta)] [ 0, 1, 0] [sin(theta), 0, cos(theta)])

Rz= ([ cos(theta), sin(theta), 0 ] [ -sin(theta), cos(theta) , 0] [ 0,0,1 ])

R = Rx(0.785398) * Ry(0.785398) * Rz(0.785398)

x = R * x We get a 3 x 1 matrix after this multiplication. The resultant matrix for the value of X,Y and Z is found by adding all the values in this case I got X = [[ 1.50000049] [-0.43934] [ 2.56065985]] therefore X= 3.62

y = R * y

Y = [[ 2] [ 3.41421352] [-0.58578667]] therefore Y= 4.82

z = R * z

Z = [[-3.53553333] [ 2.5 ] [ 2.50000082]] therefore Z= 1.46

Ideally even after the rotation of the point the length of the point from origin should remain the same but here it is varying. Length before rotation is 7.071 and length after rotation is 6.210.Could you tell me if anything is wrong.

My basic idea is to rotate the 3D point independently along the three axis by a certain angle to get the new position of of the same point now when the axis are rotated by certain angle.Pls suggest some approach.

1st Rotation of 45 degrees about what axis? $$x_{new} = R_x(45)R_y(45)R_z(45) x_{old}$$ describes 3 rotations of 45 degrees in all the fixed axis. In that order ($$R_x(45)R_y(45)R_z(45)$$), you first rotate the point around z axis, then rotate the new point around the fixed y axis, and finally you rotate the new point around the fixed x axis.
$$R = \begin{bmatrix} 0.5000 & -0.5000 & 0.7071 \\ 0.8536 & 0.1464 & -0.5000\\ 0.1464 & 0.8536 & 0.5000 \end{bmatrix}$$
so then you can get the new position of the point. It is: $$x_{new} = Rx = [ 3.0355, \ 0.6464,\ 6.3536]^T$$