コード例 #1
0
  private static Shape convertPolygon(Polygon2d polygon) {
    int[] x = new int[polygon.getNumberOfCorners()];
    int[] y = new int[polygon.getNumberOfCorners()];

    int pos = 0;
    for (Point2d pt : polygon.getCornerPoints()) {
      x[pos] = (int) pt.getX();
      y[pos] = (int) pt.getY();
      ++pos;
    }

    return new Polygon(x, y, x.length);
  }
コード例 #2
0
 @Override
 public void drawLine(Point2d start, Point2d end) {
   pipe.drawLine((int) start.getX(), (int) start.getY(), (int) end.getX(), (int) end.getY());
 }