Vector expression for intersection of a reflected ray from a cylinder I am trying to find an expression for a reflected ray from a cylindrical surface, as shown in the sketch below. 



$E$ is the starting point of the ray, $\hat d_{1}$ is the unit vector in the ray direction. $I$ is the intersection point on the cylinder, $\hat d_{2}$ unit vector in the reflected ray's direction, and $P$ is the intersection on the $Z=0$ plane. The cylinder is centered at the origin with radius $r$. Hence $I_{x}^{2} + I_{y}^{2} = r^{2}$.

I derived the following expression for the reflected ray direction in terms of the incoming ray:

$$\hat{d_{2}} = \hat{d_{1}} - 2(\hat{d_{1}}.\hat{n})\hat{n}$$

where $\hat n = (\frac{I_x}{r}, \frac{I_y}{r}, 0)$.

Also, I have:

$$P = I + \hat{d_{2}}t$$
$$P_{z} = 0$$

So, if $E$ and $I$ are known, I can solve for $P$. Thus I have $P$ in terms of $E$ and $I$.

My question is: If $E$ and $P$ are known instead, can I get an expression for $I$ in terms of $E$ and $P$? (I have not been able to derive it.)
Theory

Let $\mathbf{I}$ be a unit ray of light (we only care about direction) and let $\mathbf{\hat{u}}$ be a vector normal to a surface. 

We can decompose our ray into a parallel and perpendicular component as follows:

$$\mathbf{I} = \text{I}_\shortparallel\mathbf{u}_\shortparallel + \text{I}_\perp \mathbf{u}_\perp \tag{1}$$

As the light is reflected by the surface, the component parallel to the surface is unchanged while the component normal to it changes sign. We then write an expression for the reflected ray, $\tilde{\mathbf{I}}$

$$\tilde{\mathbf{I}} = \text{I}_\shortparallel\mathbf{u}_\shortparallel - \text{I}_\perp \mathbf{u}_\perp \tag{2}$$

It is usually easy to obtain an expression for $\text{I}_\perp\mathbf{u}_\perp$ because $\mathbf{u}_\perp = \frac{\nabla f}{|\nabla f|}$ and $\text{I}_\perp = \mathbf{I} \cdot \mathbf{u}_\perp$. 

We therefore want to get rid of the $\text{I}_\shortparallel\mathbf{u}_\shortparallel$ in $(2)$ by solving for it in $(1)$ and replacing. Doing that computation:

$$\text{I}_\shortparallel\mathbf{u}_\shortparallel = \mathbf{I}-\text{I}_\perp\mathbf{u}_\perp$$

so we arrive at

$$ \tilde{\mathbf{I}} = \mathbf{I} - 2\text{I}_\perp\mathbf{u}_\perp$$

where $\text{I}_\perp = \mathbf{I} \cdot \mathbf{u}_\perp$ and $\mathbf{u}_\perp = \frac{\nabla f}{|\nabla f|}$

leading to a final expression:

$$ \tilde{\mathbf{I}} = \mathbf{I} - 2\left(\mathbf{I} \cdot \frac{\nabla f}{|\nabla f|}\right)\frac{\nabla f}{|\nabla f|}$$

This is the general equation and will work for any surface normal at any point. You can use it without thinking at all. 

Now in your case we are dealing with a cylinder. Cylinders can be nicely described with cylindrical coordinates but I will use cartesian coordinates: $x^2 + y^2 = r^2$. Then we know that the normal vector at any point on the cylinder is $\nabla f(x,y) = (2x, 2y, 0)$ where $f(x,y) = x^2 + y^2 = r^2$ (and is a level set of the function $z^2 = x^2 + y^2$). 

Let $\mathbf{E}$ be a point such that ray $\mathbf{I}$ emanates from $\mathbf{E}$. $\mathbf{I}$ intersects $f$ at the point defined by $|\mathbf{p}_\text{intersection}| = |\mathbf{E} + \alpha \mathbf{I}| = r$. For multiple intersections we choose the point $\mathbf{p}$ closest to $\mathbf{E}$. We solve for this point of intersection with the cylinder as follows:

$$\begin{align}
p_x &amp;= \alpha(E_x + I_x)\\
p_y &amp;= \alpha(E_y + I_y)\\
p_z &amp;= \alpha(E_z + I_z)
\end{align}
$$

so $$\alpha = \frac{r^2}{\sum (E_i + I_i)^2}$$

and we then compute the point of intersection $\mathbf{p} = \mathbf{E} + \alpha\mathbf{I}$. 

We now know where the ray hits the cylinder and can compute the reflected ray $\tilde{\mathbf{I}}$. Now we must find where the reflected ray intersects an arbitrary plane. Consider some plane given by a normal $\mathbf{\hat{n}}$ and a point $\mathbf{r}_0$ such that if $\mathbf{r}$ lies on the plane $(\mathbf{r} - \mathbf{r}_0)\cdot \mathbf{\hat{n}} = 0$. 
If the intersection point of $\tilde{\mathbf{I}}$ is not normal to $\mathbf{\hat{n}}$ then it will intersect our plane exactly at the point $\mathbf{w}$ defined implicitly by 

$$(\mathbf{w} - \mathbf{r}_0)\cdot\mathbf{\hat{n}} = 0$$

Again we solve for the parameter, although this time it is a bit easier. With $\mathbf{w}$ given by $\mathbf{w} = \mathbf{p} + \beta \mathbf{\tilde{I}}$, 

$$\begin{align}
(\mathbf{w} - \mathbf{r}_0)\cdot\mathbf{\hat{n}} &amp;= 0 \\
(\mathbf{p} + \beta \mathbf{\tilde{I}} - \mathbf{r}_0)\cdot\mathbf{\hat{n}} &amp;= 0 \\
\mathbf{p}\cdot\mathbf{\hat{n}} + \beta \mathbf{\tilde{I}}\cdot\mathbf{\hat{n}} - \mathbf{r}_0\cdot\mathbf{\hat{n}}  &amp;=0\\
\end{align}
$$

so 

$$\beta =  \frac{\mathbf{r}_0\cdot\mathbf{\hat{n}} - \mathbf{p}\cdot\mathbf{\hat{n}}}{ \mathbf{\tilde{I}}\cdot\mathbf{\hat{n}} }$$

with which we can compute $\mathbf{w}$, the point where the reflected ray intersects a plane. 



Answer

Assume we are only given $\mathbf{E}$, the origin point of the ray, and $\mathbf{w}$, the point where the ray intersects some plane. Is the mapping from $\mathbf{E}$ to $\mathbf{w}$ invertible such that $\mathbf{I}$ is recoverable? 

This is equivalent to asking whether each $\mathbf{w}$ is uniquely generated by the $\mathbf{I}$s. The answer to this question is no. 

I can pick any $\mathbf{w}$ on a plane, any starting point $\mathbf{E}$, and any point on the cylinder, and there exists some $\mathbf{I}$ which emanates from $\mathbf{E}$ whose reflection on the cylinder intersects the plane at $\mathbf{w}$.
Find the midpoint of E and P, and project it on the cylinder. This gives I directly.
$$
I_{z} = \frac{1}{2}(E_{z}+P_{z}) \\
I_{x}= \frac{rx}{\sqrt{x^{2}+y^{2}}}\\
I_{y} = \frac{ry}{\sqrt{x^{2}+y^{2}}}
$$ 
where $x=\frac{E_{x}+P_{x}}{2}$ and $x=\frac{E_{y}+P_{y}}{2}$.