# Why is the drag force multiplied by the inverse normalised velocity vector?

In pure physics texbooks, I'm seeing this formula to calculate fluid drag force:

$\dpi{100} F_d = -\frac{1}{2}\rho v^2C_dA$

It is clearly stated that it should be opposite to the velocity. Now to me that means, in pseudocode:

fd = get_drag(v) // using the above formula
if v < 0: fd = -fd

That is, if the velocity is negative the drag should be positive, so we invert the returned value.

However, in game code, game physics books and tutorials, I see people doing:

drag = -v
drag.normalise()
fd = get_drag(v)
fd *= drag

That is, we multiply the drag force by the (inverted) velocity unit vector.

This to me is logic in regard to the sign, but also it scales down the drag force by a factor between 0 and 1.

Which one is correct, and why?

PS: to be noted, normalisation involves square root, multiplications and divisions, so it's more expensive than a conditional check and subtraction.

Both ideas are actually correct, but the second code snippet seems wrong to me.

If it is the same get_drag() in both cases, then it should operate on a scalar, and return a negative number. It should be something like: