In mathematics, a vector is said to be normal to a surface if it is perpendicular. In other words, normal vectors always point directly away from something.
Multiplying a scalar by a normal vector will get you a vector that represents displacement in the direction of the normal. Often normals have a handy property that they are unit-length, so if you want to move 5 units in the normal direction, nothing more than a multiplication is necessary. If it is not the case that the normal is unit-length, then an expensive normalization will be required.
Now, I am concerned by the naming in this code snippet. Norm actually has a different meaning from normal. In many contexts, the norm is actually the length, size or extent. A vector's norm, for instance, is a scalar that represents its length.
The fact that directly above the variable named norm
is another variable named length
and norm
is declared as a vector rather than a scalar give enough context clues to indicate that norm
is probably short-hand for normal, but this is poor naming.