private boolean intersects(Polygon p) {
		double[] xy = new double[6];
		PathIterator pi = p.getPathIterator(null);
		if (tempLine == null)
			tempLine = new Line2D.Double();
		int count = 0;
		double x1 = 0, y1 = 0;
		while (!pi.isDone()) {
			int type = pi.currentSegment(xy);
			if (type == PathIterator.SEG_MOVETO || type == PathIterator.SEG_LINETO) {
				if (count == 0) {
					x1 = xy[0];
					y1 = xy[1];
				} else {
					tempLine.x1 = x1;
					tempLine.y1 = y1;
					x1 = xy[0];
					y1 = xy[1];
					tempLine.x2 = x1;
					tempLine.y2 = y1;
					if (intersects(tempLine))
						return true;
				}
			}
			count++;
			pi.next();
		}
		return false;
	}