/* Function seg_cmp returns * -1 if S1 HAS TO BE to the right/below S2 to avoid a crossing, * 0 if a crossing is unavoidable or there is no crossing at all or * the segments are parallel, * 1 if S1 HAS TO BE to the left/above S2 to avoid a crossing * * Note: This definition means horizontal segments have track numbers * increasing as y decreases, while vertical segments have track numbers * increasing as x increases. It would be good to make this consistent, * with horizontal track numbers increasing with y. This can be done by * switching B_DOWN and B_UP in the first call to segCmp. At present, * though, I'm not sure what assumptions are made in handling parallel * segments, so we leave the code alone for the time being. */ static int seg_cmp(segment* S1, segment* S2) { if(S1->isVert!=S2->isVert||S1->comm_coord!=S2->comm_coord) { agerr (AGERR, "incomparable segments !! -- Aborting\n"); longjmp(jbuf, 1); } if(S1->isVert) return segCmp (S1, S2, B_RIGHT, B_LEFT); else return segCmp (S1, S2, B_DOWN, B_UP); }
/* Function seg_cmp returns * -1 if S1 HAS TO BE to the right/below S2 to avoid a crossing, * 0 if a crossing is unavoidable or there is no crossing at all or * the segments are parallel, * 1 if S1 HAS TO BE to the left/above S2 to avoid a crossing * * Note: This definition means horizontal segments have track numbers * increasing as y decreases, while vertical segments have track numbers * increasing as x increases. It would be good to make this consistent, * with horizontal track numbers increasing with y. This can be done by * switching B_DOWN and B_UP in the first call to segCmp. At present, * though, I'm not sure what assumptions are made in handling parallel * segments, so we leave the code alone for the time being. */ static int seg_cmp(segment* S1, segment* S2) { if(S1->isVert!=S2->isVert||S1->comm_coord!=S2->comm_coord) { fprintf (stderr, "incomparable segments !! -- Aborting\n"); exit(1); } if(S1->isVert) return segCmp (S1, S2, B_RIGHT, B_LEFT); else return segCmp (S1, S2, B_DOWN, B_UP); }