I was trying to understand when a projection of a vector $\vec{u}$ onto a vector $\vec{v}$ is $\vec{v} \cos(\phi)$, where $\phi$ is the angle between the vectors. In the picture below, it's called $\alpha$.
I want to understand this because, in the context of computer graphics, in an explanation of the formula to find the reflection vector to a point $p$ on a surface uses the fact that the projection of vector light (which I call it here $\vec{u}$) onto the surface normal at point $p$ (which I call here $\vec{v}$) is $\vec{v} \cos(\phi)$.
For example, suppose we have this situation:
We first compute the number $OA'$ that multiplied by $\vec{v}$ gives the projected vector of $\vec{u}$ onto $\vec{v}$, lets call it $\vec{w}$.
$$\cos(\phi) = \frac{OA'}{|\vec{u}|}$$
This comes from that $|\vec{u}|$ is the hypotenuse and $OA'$ is the adjacent catheti.
So we have
$$|\vec{u}|\cos(\phi) = OA'$$
The dot product between $\vec{u}$ and vector $\vec{v}$ is
$$\vec{u}\cdot\vec{v} = |\vec{v}||\vec{u}| \cos(\phi) = |\vec{v}|OA'$$
Thus we have that $$\frac{\vec{v} \cdot \vec{u}}{|\vec{v}|} = OA'$$
The vector projection is thus $OA'$ times the $\frac{\vec{v}}{|\vec{v}|}$ to obtain $\vec{w}$.
$$\vec{w} = OA'* \frac{\vec{v}}{|\vec{v}|} = \frac{\vec{v} \cdot \vec{u}}{|\vec{v}|} * \frac{\vec{v}}{|\vec{v}|} = \frac{\vec{u} \cdot \vec{v}}{|\vec{v}|^2} \vec{v} = \frac{1}{|\vec{v}|}\frac{\vec{u} \cdot \vec{v}}{|\vec{v}|} \vec{v} = \frac{1}{|\vec{v}|}OA' \vec{v} = \frac{1}{|\vec{v}|}|\vec{u}|\cos(\phi) \vec{v} = \frac{|\vec{u}|}{|\vec{v}|} \cos(\phi) \vec{v}$$
So, the conclusion to my initial question seems to be when the length of vector $\vec{u}$ and vector $\vec{v}$ are the same. Is this correct?
