Project one vector onto another and compute the scalar and vector projections.
The vector projection of A onto B is the component of A in the direction of B: proj_B(A) = (A·B / ||B||²) × B. The scalar projection is A·B / ||B|| (the signed length of the shadow). The orthogonal component A − proj_B(A) is perpendicular to B.
Vector Projection
proj_B(A) = (A·B / ||B||²) × B
Scalar Projection
comp_B(A) = A·B / ||B||
Scalar projection is the signed magnitude (a number). Vector projection is the actual vector in the direction of B whose length equals the scalar projection.
It is A minus the projection: the part of A perpendicular to B. Together, the projection and orthogonal component reconstruct A.