import { vec3 } from "gl-matrix";

/**
 *
 * @param {vec3} out
 * @param {vec3} input
 */
export function NormalizeSafe(out, input) {

    const len = vec3.length(input);

    if (len !== 0) {
        const m = 1 / len;

        vec3.scale(out, input, m)

    } else {
        vec3.copy(out, input);
    }
}
