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