normalized method

DVVec3 normalized()

This direction at unit length; the zero vector stays zero rather than becoming NaN, which would poison every transform downstream.

Implementation

DVVec3 normalized() {
  final double l = length;
  return l == 0 ? this : this * (1 / l);
}