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 [rad]$
$$ Rx= \begin{bmatrix} 1& 0& 0\\ 0& cos(\theta)& sin(\theta)\\ 0& -sin(\theta)& cos(\theta)\\ \end{bmatrix}$$
$$ Ry= \begin{bmatrix} cos(\theta)& 0& -sin(\theta)\\ 0& 1& 0\\ sin(\theta)& 0& cos(\theta)\\ \end{bmatrix}$$
$$ Rz=\begin{bmatrix} cos(\theta)& sin(\theta)& 0\\ -sin(\theta)& cos(\theta)& 0\\ 0& 0& 1 \\ \end{bmatrix}$$
Rz= ([ cos(theta), sin(theta), 0 ] [ -sin(theta), cos(theta) , 0] [ 0,0,1 ])
$$R(\theta) = Rx(\theta)* Ry(\theta)* Rz(\theta)$$ $$x_{rotated} = R(\theta) * 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. Please suggest some approach.