51 #define D ((ax2-ax1)*(by1-by2) - (ay2-ay1)*(bx1-bx2)) 53 #define D1 ((bx1-ax1)*(by1-by2) - (by1-ay1)*(bx1-bx2)) 55 #define D2 ((ax2-ax1)*(by1-ay1) - (ay2-ay1)*(bx1-ax1)) 59 double ax2,
double ay2,
60 double bx1,
double by1,
double bx2,
double by2)
62 register double d, d1, d2;
66 if (ax1 > ax2 || (ax1 == ax2 && ay1 > ay2)) {
76 if (bx1 > bx2 || (bx1 == bx2 && by1 > by2)) {
89 else if (bx1 == ax1) {
92 else if (bx2 == ax2) {
95 else if (by1 == ay1) {
123 return (d1 >= 0 && d2 >= 0 && d >= d1 && d >= d2);
125 return (d1 <= 0 && d2 <= 0 && d <= d1 && d <= d2);
152 if (ay1 == by2 || ay2 == by1)
175 if (ax1 == bx2 || ax2 == bx1)
186 double ax2,
double ay2,
187 double bx1,
double by1,
188 double bx2,
double by2,
double *
x,
double *y)
190 register double d, r1, r2;
194 if (ax1 > ax2 || (ax1 == ax2 && ay1 > ay2)) {
204 if (bx1 > bx2 || (bx1 == bx2 && by1 > by2)) {
217 else if (bx1 == ax1) {
220 else if (bx2 == ax2) {
223 else if (by1 == ay1) {
252 if (r1 < 0 || r1 > 1 || r2 < 0 || r2 > 1) {
255 *x = ax1 + r1 * (ax2 - ax1);
256 *y = ay1 + r1 * (ay2 - ay1);
288 if (ay1 > by1 && ay1 < by2) {
318 if (ax1 > bx1 && ax1 < bx2) {
int dig_find_intersection(double ax1, double ay1, double ax2, double ay2, double bx1, double by1, double bx2, double by2, double *x, double *y)
int dig_test_for_intersection(double ax1, double ay1, double ax2, double ay2, double bx1, double by1, double bx2, double by2)