Beispiel #1
0
 public boolean isRectangular(double tolerance) {
   EdgeRing edges = getEdges();
   for (Segment2D edge : edges) {
     double angle =
         AngleUtil.getSmallestDifference(edge.getAngle(), edges.getPrevious(edge).getAngle());
     if (angle < AngleUtil.RIGHT - tolerance) return false;
     if (angle > AngleUtil.RIGHT + tolerance && angle < AngleUtil.FLAT - tolerance) return false;
   }
   return true;
 }
Beispiel #2
0
 public EdgeRing getEdges() {
   if (edges == null) {
     edges = new EdgeRing();
     for (int i = 0; i < points.size(); i++)
       edges.add(new Segment2D(points.get(i), points.getNext(i)));
   }
   return edges;
 }
Beispiel #3
0
  public Polygon(EdgeRing col) {
    points = new PointRing();
    edges = new EdgeRing(col);
    if (!edges.loop())
      throw new RuntimeException(
          "Can't construct " + this.getClass().getName() + " because edge list is not valid loop.");

    for (Segment2D edge : edges) points.add(edge.getStart());
    check();
  }