ckrbd.js
//Returns {d2:distance from i,j to closest dot, m:index in dotKs of first closest dot, k: k of that dot}
Returns {d2:distance from i,j to closest dot, m:index in dotKs of first closest dot, k: k of that dot}
Returns { d2 : distance from i j to closest dot m : index in dotKs of first closest dot k : k of that dot }
function minD2(i,j,dotKs){
    var mnM = 0;
    var mnD2 = d2(i,j,dots[dotKs[0]].i,dots[dotKs[0]].j);
    for (let m=1;m<dotKs.length;m++) {
        let d = d2(i,j,dots[dotKs[m]].i,dots[dotKs[m]].j);
        if (d<mnD2) { mnD2 = d; mnM = m; }
    }
    return {d2:mnD2, m:mnM, k:dotKs[mnM]};
}
function minD2 ( i , j , dotKs ) { var mnM = 0 ; var mnD2 = d2 ( i , j , dots [ dotKs [ 0 ] ] . i , dots [ dotKs [ 0 ] ] . j ) ; for ( let m = 1 ; m < dotKs . length ; m ++ ) { let d = d2 ( i , j , dots [ dotKs [ m ] ] . i , dots [ dotKs [ m ] ] . j ) ; if ( d < mnD2 ) { mnD2 = d ; mnM = m ; } } return { d2 : mnD2 , m : mnM , k : dotKs [ mnM ] } ; }
Returns {d2:distance from i,j to closest dot, m:index in dotKs of first closest dot, k: k of that dot}
Returns { d2 : distance from i j to closest dot m : index in dotKs of first closest dot k : k of that dot }