Iterate over all points other than the current point
for ( let j = 0 ; j < points . length ; ++ j ) { if ( j == i ) continue ; let dy = points [ i ] [ 1 ] - points [ j ] [ 1 ] ; let dx = points [ i ] [ 0 ] - points [ j ] [ 0 ] ;