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); }
@Override public void drawLine(Point2d start, Point2d end) { pipe.drawLine((int) start.getX(), (int) start.getY(), (int) end.getX(), (int) end.getY()); }