I have a convex polygon and some points. I have to form a line between 2 points and then form a triangle with another point. The point from inside the triangle are inside the polygon too. The algorithm continues by forming triangles until finding all the points belonging to the polygon. I need some help, 'cause I'm new to java and don't know how to solve this problem. I managed to write the function to check if a point belongs to the line created.
public static void calculateLine(Point Q, Point P, Point x) {
double a, b;
a = Q.y - P.y;
b = P.x - Q.x;
double c = a * (P.x) + b * (P.y);
if (a * x.x + b * x.y == c)
System.out.println("point belongs to line");
else {
System.out.println("point doesn't belong to line");
}
}
}