I have written a code which first get some points(has x ,y) and then I will check all possible triangles with those points and I will check that the specific point is in a triangle or not(with determinate) but I have problem with this part of code which finds the external points and internal points.it doesn't work well.please help me thanks.
public void externalPoints(List<Point> pointList) {
// this method will check that a point is in a (n-1)(n-2)(n-3)/6 triangles or not
int n = pointList.size();
if (n <= 2) {
System.out.println("null");
} else if (n == 3) {
drawingLine();
} else {
for (int i = 0; i < n; i++) {
for (int j = 1; j < n; j++) {
for (int k = 2; k < n; k++) {
for (int m = 3; m < n; m++) {
if (isPointInTriangle(pointList.get(i), pointList.get(j), pointList.get(k), pointList.get(m)) == true) {
System.out.println("is in the triangle");
break;
} else {
System.out.println("is not in a triangle");
newList.add(pointList.get(i));
}
}
}
}
}
}
}
Also isInTriangle
method is like this site :link text