74 #define D ((ax2-ax1)*(by1-by2) - (ay2-ay1)*(bx1-bx2)) 75 #define D1 ((bx1-ax1)*(by1-by2) - (by1-ay1)*(bx1-bx2)) 76 #define D2 ((ax2-ax1)*(by1-ay1) - (ay2-ay1)*(bx1-ax1)) 78 #define SWAP(x,y) {double t; t=x; x=y; y=t;} 81 double bx1,
double by1,
double bx2,
double by2,
82 double *ra,
double *rb,
double *
x,
double *y)
86 if (ax1 > ax2 || (ax1 == ax2 && ay1 > ay2)) {
91 if (bx1 > bx2 || (bx1 == bx2 && by1 > by2)) {
102 *x = ax1 + (*ra) * (ax2 - ax1);
103 *y = ay1 + (*ra) * (ay2 - ay1);
104 return (*ra >= 0.0 && *ra <= 1.0 && *rb >= 0.0 && *rb <= 1.0);
141 if (ay1 > by1 && ay1 < by2) {
177 if (ax1 > bx1 && ax1 < bx2) {
int G_intersect_line_segments(double ax1, double ay1, double ax2, double ay2, double bx1, double by1, double bx2, double by2, double *ra, double *rb, double *x, double *y)