The projection formula
The vector projection of v₁ onto v₂ is proj = ((v₁·v₂)/(v₂·v₂)) × v₂. The scalar projection (component) is comp = (v₁·v₂)/|v₂|.
The scalar projection tells you how much of v₁ lies along v₂. If negative, v₁ points partly opposite to v₂.
proj_v₂(v₁) = ((v₁·v₂)/(v₂·v₂)) × v₂
Vector projection formula.