I have a quad type which is defined as:
typedef struct __point {
float x;
float y;
} point_t;
typedef struct __quad {
point_t p1;
point_t p2;
point_t p3;
point_t p4;
} quad_t;
If I have two of those quads on the same plane, I would like to be able to work out the intersection points of those quads. For example, if we have quad A and quad B, if any of B's points fall outside of A, the algoritm should yield a quad with points as shown in the illustration below (A is in red, B is in purple):
Edit: Ordering of the points is not important because I will later use those points to construct a quad that is going to be drawn inside A.