newton.math.normalize_with_norm#

newton.math.normalize_with_norm(x)[source]#

Normalize a vector and return both the unit vector and the original norm.

If the input has zero length it is returned unchanged with a norm of 0.0.

Parameters:

x (Any) – Input vector.

Returns:

(normalized_x, norm) where normalized_x is the unit-length direction and norm is wp.length(x).

Return type:

Tuple[vector, float]