Determine se três pontos são colineares
Crie um método Program.SameLine que retorne se três pontos estão sobre a mesma linha reta. Cada ponto é representado como [x, y].
Exemplos
Program.SameLine(new int[][] { new int[] { 0, 0 }, new int[] { 1, 1 }, new int[] { 3, 3 } }); // ➞ true
Program.SameLine(new int[][] { new int[] { -2, -1 }, new int[] { 2, 1 }, new int[] { 0, 0 } }); // ➞ true
Program.SameLine(new int[][] { new int[] { -2, 0 }, new int[] { -10, 0 }, new int[] { -8, 0 } }); // ➞ true
Program.SameLine(new int[][] { new int[] { 0, 0 }, new int[] { 1, 1 }, new int[] { 1, 2 } }); // ➞ false
Program.SameLine(new int[][] { new int[] { 3, 4 }, new int[] { 3, 5 }, new int[] { 6, 6 } }); // ➞ falseNotas
Lembre-se de que uma linha reta pode ser vertical, horizontal ou inclinada.