3D reflection of a ray on a cylindrical mirror I am trying to calculate the reflection of a ray on a cylindrical mirror in a three-dimensional space. To achieve this, can I apply the laws of reflection separately in xy and xz planes (as in the attached picture), or is it more complicated than that? (my intuition say "yes" but it has often been wrong in the past)

If so, is it true regardless of the shape of the mirror ?
 A: If an incident ray with direction $\boldsymbol{\hat{\imath}}$ is reflected on a surface with normal direction $\boldsymbol{\hat{n}}$, then the direction of the emitted ray is $$\boldsymbol{\hat{e}} = \boldsymbol{\hat{\imath}} - 2 (\boldsymbol{\hat{\imath}}\cdot \boldsymbol{\hat{n}}) \boldsymbol{\hat{n}}  $$
See this post for reference. Note that $\cdot$ is the vector dot product.
All you need in your case is the cylinder normal direction $\boldsymbol{\hat{n}}$ at the incident point $\boldsymbol{\vec{r}}$. If the cylinder lies along the $\boldsymbol{\hat{z}}$ direction and through a point $\boldsymbol{\vec{r}}_C$, then the normal direction is
$$ \boldsymbol{\hat{n}} = {\rm unitvector}\left\{ (\boldsymbol{\vec{r}}-\boldsymbol{\vec{r}_C}) - \boldsymbol{\hat{z}} ( \boldsymbol{\hat{z}} \cdot (\boldsymbol{\vec{r}}-\boldsymbol{\vec{r}_C})) \right\} $$
The last part is finding out where the incident point $\boldsymbol{\vec{r}}$ given the ray and the cylinder. This is given in Slide 3 of this ray tracing tutorial, and many other online resrouces also.
The trick is the take the equation of the ray $\boldsymbol{\vec{r}}  = \boldsymbol{\vec{r}}_O + \lambda\, \boldsymbol{\hat{i}}$ and use it in the equation of the cylinder $R^2 =\left(\boldsymbol{\vec{r}}-\boldsymbol{\vec{r}_C}  - \boldsymbol{\hat{z}} \left( \boldsymbol{\hat{z}} \cdot (\boldsymbol{\vec{r}}-\boldsymbol{\vec{r}_C}) \right) \right)^2$ to solve for $\lambda$.
Note that $\boldsymbol{\vec{r}}^2 = r_x^2+r_y^2+r_z^2$ in this notation.
