klyn.math.geometry.Vector.normalize
method
public normalize() as Vector<Double>
Description

Returns a unit vector with the same direction. Finite components are scaled first, avoiding overflow and underflow even when the unscaled mathematical length is outside the Double range.

Returns

Normalized vector.

Throws
  • ZeroDivisionException If the vector has zero length.
Example
unit = Vector<Double>(3.0, 4.0).normalize()