wrote n^3 algo; bug if there are 3 points at the same line;