Пример #1
0
 public boolean hasIntersectingDiagonal(Segment2D diagonal) {
   for (Segment2D edge : getEdges()) {
     if (edge.hasCommonEnd(diagonal)) continue;
     if (edge.intersectAtSinglePoint(diagonal)) {
       return true;
       // Point2D intersection = edge.getUniqueIntersection(diagonal);
       // if(diagonal.hasPoint(intersection))
       // continue;
       // else
       // return true;
     }
   }
   return false;
 }
Пример #2
0
 // TODO verifier le check
 private boolean isSimple() {
   ArrayList<Segment2D> edges = getEdges();
   for (Segment2D e1 : edges) {
     for (Segment2D e2 : edges) {
       if (e1 == e2) continue;
       if (e1.hasCommonEnd(e2)) continue;
       if (e1.intersectAtSinglePoint(e2)) {
         Point2D intersection = e1.getUniqueIntersection(e2);
         if (e1.hasPoint(intersection) || e2.hasPoint(intersection))
           continue; // TODO à voir si on autorise le cas des edges qui se touchent mais ne se
                     // croisent pas
         // (gestion des trous)
         else return false;
       }
     }
   }
   return true;
 }