public HashMap<Integer, Edge> constructEdgeTable(Point[] vertices) {
		HashMap<Integer, Edge> EdgeTable = new HashMap<Integer, Edge>();
		int ymin, ymax, x;
		float m;
		for (int i = 1; i < vertices.length; i++) {
			if (vertices[i - 1].y < vertices[i].y) {
				ymin = vertices[i - 1].y;
				x = vertices[i - 1].x;
				ymax = vertices[i].y;
			} else {
				ymin = vertices[i].y;
				ymax = vertices[i - 1].y;
				x = vertices[i].x;
			}
			m = vertices[i].y - vertices[i - 1].y != 0 ? 1.0f
					* (vertices[i].x - vertices[i - 1].x)
					/ (vertices[i].y - vertices[i - 1].y) : 0;
			if (EdgeTable.containsKey(ymin)) {
				Edge bucket = EdgeTable.get(ymin);
				while (bucket.next != null)
					bucket = bucket.next;
				bucket.next = new Edge(ymin, ymax, x, m);
			} else {
				EdgeTable.put(ymin, new Edge(ymin, ymax, x, m));
			}
			System.out.println("Insert Edge(" + m + " " + x + " " + ymin + " "
					+ ymax + ") ");

		}
		if (vertices[vertices.length - 1].y <= vertices[0].y) {
			ymin = vertices[vertices.length - 1].y;
			x = vertices[vertices.length - 1].x;
			ymax = vertices[0].y;
		} else {
			ymin = vertices[0].y;
			ymax = vertices[vertices.length - 1].y;
			x = vertices[0].x;
		}
		m = vertices[0].y - vertices[vertices.length - 1].y != 0 ? 1.0f
				* (vertices[0].x - vertices[vertices.length - 1].x)
				/ (vertices[0].y - vertices[vertices.length - 1].y) : 0;
		if (EdgeTable.containsKey(ymin)) {
			Edge bucket = EdgeTable.get(ymin);
			while (bucket.next != null)
				bucket = bucket.next;
			bucket.next = new Edge(ymin, ymax, x, m);
		} else {
			EdgeTable.put(ymin, new Edge(ymin, ymax, x, m));
		}
		System.out.println("Insert Edge(" + m + " " + x + " " + ymin + " "
				+ ymax + ") ");

		return EdgeTable;
	}