Skip to content
  • Kenneth Moreland's avatar
    Normal of zero vectors · 7b55a3f0
    Kenneth Moreland authored
    The normal of a vector is the vector divided by the vector's magnitude.
    However, if the vector is the 0 vector, you get 0/0, which results in
    non-finite numbers.
    
    There might be legitimate situations where you (unintentionally) try to
    normalize a 0 vector. For example, you might be using the derivative of
    a field to compute the normal to a contour of the field. If the field is
    in a static region or critical point, then the gradient goes to 0.
    
    In these cases, we want the `Normal` and `Normalize` functions to return
    something reasonable. These functions now return the 0 vector back. This
    is no more "correct" than producing NaN values, but it is less likely to
    cause problems later.
    7b55a3f0