normalize method

Vector3D normalize()

Implementation

Vector3D normalize() {
  final length = this.length;
  if (length != 0.0)
  {
    final ilength = 1.0/length;
    return .vec3(
      x * ilength,
      y * ilength,
      z * ilength,
    );
  }

  return .vec3(x, y, z);
}