# Direction of reflection

I have a raytracing exercise similar to this one here: How to get a reflection vector?.

I understand how to do the calculations but I'm having trouble visualising the projections.

The answer is $r=(d-(n\cdot d)n)+(-(n\cdot d)n)=d-2(n\cdot d)n$.

I'm thinking that $\operatorname{proj} nd=(n\cdot d)n$ = the green line and $i$ just end up at $n$.

$$d+r=2(d-(d\cdot n)n)\implies r=d-2(d\cdot n)n$$
• @Marcus That's the way how I can see it clear. From basic rules for vector summation $d+r$ is the red vector and this one is twice the projection vector of vector $d$ orthogonal to $n$ (we are of course assuming $n$ such that |n|=1). – gimusi Jul 28 '18 at 20:19
• @Marcus Yes, just plot also the $-2\operatorname{proj} nd$ part and apply the parallelogram rule. – gimusi Jul 28 '18 at 20:24