home *** CD-ROM | disk | FTP | other *** search
/ gdead.berkeley.edu / gdead.berkeley.edu.tar / gdead.berkeley.edu / pub / cad-tools / ciftomann.tar / Lib / intersection.c < prev    next >
C/C++ Source or Header  |  1988-01-28  |  909b  |  50 lines

  1. #include "ciftomann.h"
  2. #include "aeledge.h"
  3. #include "intersection.h"
  4.  
  5. /* determine which one of the 13 possible ways that two edges can
  6.  * relate to each other
  7.  */
  8.  
  9. Intersection(A,M) 
  10. AEL_EDGEPTR A,M;
  11. {
  12.  
  13.     if (A->x == M->x) {
  14.     if (A->xend == M->xend) 
  15.         return(COINCIDENT);
  16.     else if (A->xend > M->xend)
  17.         return(A_LCOVERS_M);
  18.     else
  19.         return(M_LCOVERS_A);
  20.     }
  21.     else if (A->x > M->x) {
  22.     if (M->xend == A->x)
  23.         return(LPOINT);
  24.     else if (M->xend < A->x)
  25.         return(LDISJOINT);
  26.     else {
  27.         if (A->xend == M->xend)
  28.         return(M_RCOVERS_A);
  29.         else if (A->xend > M->xend)
  30.         return(LOVERLAP);
  31.         else
  32.         return(M_COVERS_A);
  33.     }
  34.     }
  35.     else {
  36.     if (A->xend == M->x) 
  37.         return(RPOINT);
  38.     else if (A->xend < M->x)
  39.         return(RDISJOINT);
  40.     else {
  41.         if (A->xend == M->xend)
  42.         return(A_RCOVERS_M);
  43.         else if (A->xend > M->xend)
  44.         return(A_COVERS_M);
  45.         else
  46.         return(ROVERLAP);
  47.     }
  48.     }
  49. }
  50.