Esempio n. 1
0
 /** @author Ali */
 @Override
 public Point2D getCenteroid() {
   if (centeroid == null) {
     centeroid = GeometryTools2D.computeCentroid(GeometryTools2D.vertexArrayToPoints(getApexes()));
   }
   return centeroid;
 }
Esempio n. 2
0
 // Morteza2011*****************************************************************
 public static ArrayList<Edge> verifyEdgesAfterMerge(List<Edge> realEdges) {
   ArrayList<Edge> edges = new ArrayList<Edge>(realEdges);
   for (short i = 0; i < edges.size(); i++) {
     double length = GeometryTools2D.getDistance(edges.get(i).getStart(), edges.get(i).getEnd());
     if (length < 100) {
       if (i > 0) {
         edges.get(i - 1).setEnd(edges.get(i).getEnd());
       } else {
         edges.get(edges.size() - 1).setEnd(edges.get(i).getEnd());
       }
       edges.remove(i--);
       continue;
     }
     for (short j = (short) (i + 1); j < edges.size(); j++) {
       if (edges.get(i).edgeEquals(edges.get(j))) {
         edges.remove(j--);
       }
     }
   }
   return edges;
 }