){
        min_d = Math.pow(polynomial_xs[0] - client_to_x(client_x), 2) + Math.pow(polynomial_ys[0] - client_to_y(client_y), 2);
        min_i = 0;
        for(var i = 1; i < polynomial_n; ++i){
            var di = Math.pow(polynomial_xs[i] - client_to_x(client_x), 2) + Math.pow(polynomial_ys[i] - client_to_y(client_y), 2);
            if(di < min_d){
                min_d = di;
                min_i = i;
            }
        }
        polynomial_i = min_i;
        polynomial_context.setLineDash([4, 4]);