src/utils/geometry.js
function normalize (x, y) {
    const s = Math.hypot(x, y);
    return [x / s, y / s];
}
function normalize (x, y) {
    const s = Math.hypot(x, y);
    return [x / s, y / s];
}
function normalize ( x , y ) { const s = Math . hypot ( x , y ) ; return [ x / s , y / s ] ; }
Return the vector scaled to length 1
Return the vector scaled to length 1