I learned that, given a point $(x,y)$ in the plane, $\sigma_{\phi}(x,y) = (x\cos(\phi)-y\sin(phi),x\sin(\phi)+x\cos(\phi))$ is the point corresponding to rotating $(x,y)$ by an angle $\phi$ counter-clockwise. This can be used for finding the equation of a rotated parabola, for example. I thought about the formula and realized that, writing $(x,y)$ in polar form $(r\cos(\varphi), r\sin(\varphi))$, it is clear that the rotated point is $(r\cos(\varphi+\phi)), r\sin(\varphi+\phi)$. Applying the formulas for the sine and the cosine of the sum of two angles, I obtained the expression of $\sigma_{\phi}(x,y)$.
EDIT: the inspiration of this questions is that I'd like to rotate a cone so its axis becomes another line (for example, so a 'tilted cone' becomes a vertical one). Hence the title of the question.
Now, I'd like to know how to rotate a figure in space so that the $z$ axis becomes a certain line of my election. I thought that using spherical coordinates would be the natural approach. I spherical coordinates, $$x = r\sin(\phi)\cos(\theta)\\ y = r\sin(\phi)\sin(\theta)\\ z = r\cos(\phi) $$ being $\theta$ the polar angle and $\phi$ the angle with the $z$ axis. In my case, I want to add $\phi_0$ to the angle $\phi$. Applying the formulas of the sine and cosine of the sum of angles, I got that the point $(x',y',z')$ corresponding to rotating a point $(x,y,z)$ is $$ x' = x\cos(\phi_0)+z\sin(\phi_0)\cos(\theta) \\ y' = y\cos(\phi_0)+z\sin(\phi_0)\sin(\theta)\\ z' = z\cos(\phi_0)-r\sin(phi_1)\sin(\phi) $$
The angles $\theta$ and $\phi$ should be found from $(x,y,z)$. Is my approach correct? Is there an easier way to do this? I would really appreciate if someone could point me in the right direction.