I want to define the projection of a vector $\mathbf{v} \in \mathbb{R}^3$ onto the line $\mathbf{r} \in \mathbb{R}^3$ in terms of the components of $\mathbf{v} = (v_x, v_y, v_z)$. In 2D, this looks like the following:
2D component-wise vector projection
The magnitude of the component-wise projection of the velocity vector $\mathbf{v}$ onto $\mathbf{r}$ is the radial velocity $v_r$, and (in 2D) can be expressed as the following:
$$ v_r = \text{comp}_{\mathbf{r}} \mathbf{v}_x + \text{comp}_{\mathbf{r}} \mathbf{v}_y = v_x \cos \theta + v_y \sin \theta $$
or in vector form,
$$ v_r = \begin{bmatrix} \cos \theta & \sin \theta \end{bmatrix} \begin{bmatrix} v_x \\ v_y \end{bmatrix} $$
The 3D case becomes a bit more complicated, and this is where I haven't been able to understand the geometry of the component-wise projection. In the 3D case, we have the vector $\mathbf{r}$ expressed in a form of polar coordinates where the azimuth angle $\theta$ is defined in the x-y plane relative to the positive y-axis, and the elevation angle $\phi$ is defined in the w-z plane relative to the positive w-axis, where the direction of the w-axis is defined by the direction of the projection of $\mathbf{r}$ onto the x-y plane.
The 3D vector $\mathbf{v}$ is defined with its origin at the point $(x,y,x)$ and has components $(v_x, v_y, v_z)$. The magnitude of the component-wise projection of $\mathbf{v}$ onto $\mathbf{r}$ will be a function of both the azimuth ($\theta$) and elevation ($\phi$) angles of the form:
$$ v_r = \begin{bmatrix} f_1(\theta, \phi) & f_2(\theta, \phi) & f_3(\theta, \phi) \end{bmatrix} \begin{bmatrix} v_x \\ v_y \\v_z \end{bmatrix} $$