This is derived from trigonometry, and the earlier identity that |A||B|cos(theta) is equal to the dot product of A and B. (In fact, this is where the dot product itself comes from.) The direction of the projected vector is the same as B.Therefore:Code:// Definition of the projection vectorA proj B = (A .* (B/|B|)) * (B/|B|)Here is a simple function for getting the projection of one vector onto ano