Esempio n. 1
0
 /**
  * Scans all the edges of the two elements and if it finds one that is equal, then sets this as
  * the Edge of the EdgeRelation
  */
 public Edge getRelatedEdge(Element e) {
   int edim = e.getDim();
   Element.Edge my_edge, e_edge0, e_edge1, e_edge2 = null;
   my_edge = edges[0];
   e_edge0 = e.edges[0];
   if (my_edge.equals(e_edge0)) {
     return my_edge;
   }
   e_edge1 = e.edges[1];
   if (my_edge.equals(e_edge1)) {
     return my_edge;
   }
   if (edim == 3) {
     e_edge2 = e.edges[2];
     if (my_edge.equals(e_edge2)) {
       return my_edge;
     }
   }
   my_edge = edges[1];
   if (my_edge.equals(e_edge0)) {
     return my_edge;
   }
   if (my_edge.equals(e_edge1)) {
     return my_edge;
   }
   if (edim == 3) {
     if (my_edge.equals(e_edge2)) {
       return my_edge;
     }
   }
   if (dim == 3) {
     my_edge = edges[2];
     if (my_edge.equals(e_edge0)) {
       return my_edge;
     }
     if (my_edge.equals(e_edge1)) {
       return my_edge;
     }
     if (edim == 3) {
       if (my_edge.equals(e_edge2)) {
         return my_edge;
       }
     }
   }
   return null;
 }
Esempio n. 2
0
 /**
  * @param e a segment or triangle
  * @return if the current triangle has a common edge with e
  */
 public boolean isRelated(Element e) {
   int edim = e.getDim();
   Element.Edge my_edge, e_edge0, e_edge1, e_edge2 = null;
   my_edge = edges[0];
   e_edge0 = e.edges[0];
   if (my_edge.equals(e_edge0)) {
     return true;
   }
   e_edge1 = e.edges[1];
   if (my_edge.equals(e_edge1)) {
     return true;
   }
   if (edim == 3) {
     e_edge2 = e.edges[2];
     if (my_edge.equals(e_edge2)) {
       return true;
     }
   }
   my_edge = edges[1];
   if (my_edge.equals(e_edge0)) {
     return true;
   }
   if (my_edge.equals(e_edge1)) {
     return true;
   }
   if (edim == 3) {
     if (my_edge.equals(e_edge2)) {
       return true;
     }
   }
   if (dim == 3) {
     my_edge = edges[2];
     if (my_edge.equals(e_edge0)) {
       return true;
     }
     if (my_edge.equals(e_edge1)) {
       return true;
     }
     if (edim == 3) {
       if (my_edge.equals(e_edge2)) {
         return true;
       }
     }
   }
   return false;
 }