161162163164165166167168169170171
public boolean intersects(Rectangle2D r) { if(np==0)return false; Line2D line = new Line2D.Double(x[0],y[0],x[0],y[0]); for (int i = 1; i < np; i++) { line.setLine(x[i-1], y[i-1], x[i], y[i]); if(line.intersects(r))return true; } return false; } /**