# Rotating a cone

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.

• I'm sure you know this, but just in case... Knowing where the $z$-axis go does not uniquely specify the new coordinate system. After all, you can precompose such a rotation with a rotation about the original $z$-axis, or postcompose with a rotation about the new $z$-axis. Nov 6 '21 at 20:49
• But, if you are happy with any rotation mapping the $z$-axis to the chosen line there are many ways. A trick I often resort to is to use the fact that a composition of two orthogonal reflections (w.r.t. planes) is a rotation about the intersection of the two planes. Here I might first reflect w.r.t. the plane $x=0$, i.e. just map $(x,y,z)\mapsto (-x,y,z)$. This is followed by a reflection w.r.t. to the plane bisecting the angle between the old and new $z$-axes (and also containing the line orthogonal to both). Nov 6 '21 at 20:55
• Basically your goal seems to be invert the process described here. Please ask for more detailed help, if you cannot invert that process on your own (though it is a useful exercise). Nov 6 '21 at 20:57
• Oh, and if you know the normal vector of a plane in 3D, there is a simple formula for the orthogonal reflection w.r.t. it. The formula explained. Here I use it. Nov 6 '21 at 21:02
• Only now I remember that you are rotating a cone. In that case the extra ambiguity won't bother you because a cone has an axis of symmetry, and won't be bothered by a rotation about the axis of symmetry. Actually, the cone is also stable under the first reflection, so you can just omit that part (at least if you only want the equation of the final cone). I use that extra dummy reflection, because a reflection reverts the handedness. Sometimes you want to keep handedness (say an image something drawn on the cone should not get "flipped"). Nov 6 '21 at 21:10

The equation of a circular cone is determined by two things: It's axis represented by the unit vector $$\mathbf{a}$$, and the semi-vertical angle which is the angle $$\theta$$ ​between the axis and the curved surface.

A point $$\mathbf{r} = [x, y, z]^T$$ is on the surface of the cone if

$$\mathbf{r}^T \mathbf{a} = \cos \theta \sqrt{ \mathbf{r}^T \mathbf{r} }$$

Squaring both sides

$$\mathbf{r}^T \mathbf{a} \mathbf{a}^T \mathbf{r} = \cos^2 \theta \mathbf{r}^T \mathbf{r}$$

which can be written as

$$\mathbf{r}^T \left( \cos^2 \theta I_3 - \mathbf{a} \mathbf{a}^T \right) \mathbf{r} = 0$$

And this is the equation of the cone for any orientation of the axis $$\mathbf{a}$$.

In spherical coordinates:

$$\mathbf{a} = \begin{bmatrix} \sin \phi \cos \psi \\ \sin \phi \sin \psi \\ \cos \phi \end{bmatrix}$$

To generate the new axis just plug in the new values for $$\phi$$ and $$\psi$$.

• This is much simpler than what I described in the comments (when thinking only about getting the rotation matrix). Simpler is better :-) Nov 9 '21 at 5:00
• Let's say we have a cone with its axis along $\mathbf{e}_z$ basis vector. Its aperture angle $\theta$ then coincides with the the angle $\phi$ of spherical coordinates, i.e. the solid cone is defied for $0 \le \phi \le \theta$ and $0 \le \psi \le 2\pi$. Now we rotate the cone with a matrix $\mathbf{R}$. What are the new ranges of the angles $\phi$ and $\psi$ that define the rotated cone? It seems that the angles/ranges are no longer independent, i.e. $\psi$ becomes a function of $\phi$. How to work out this dependence and the new ranges? And how to extend this to an $n$-d cone? Thank you. Nov 23 '21 at 22:34
• PS. It seem to me that the new range of $\phi$ is given by $\mathrm{acos}(\mathbf{e}_z \cdot \mathbf{R} \mathbf{e}_z) \pm \theta$ (or should it be the inverse of $\mathbf{R}$?), but not sure how to work out the dependence and range of $\psi$. Nov 23 '21 at 22:56
• $\phi$ and $\psi$ are the spherical angles of the axis of the cone, so when you apply a rotation matrix, the new $\psi$ and $\phi$ are obtained from the vector $\mathbf{R a}$ Nov 23 '21 at 23:24
• Thank you for your reply. When the axis of the cone is initially aligned with the $z$-axis, which is the starting point in my first comment, the angles $\phi$ and $\psi$ are those of the spherical coordinates. Thank you. Nov 23 '21 at 23:58