-
/*import java.io.*;
import java.util.Stack;
import java.util.Hashtable;*/
* Print the voronoi diagram and its dual, the delaunay triangle for the
* diagram.
**/
- /*void outputVoronoiDiagram()
+ void outputVoronoiDiagram()
{
Edge nex = this;
// Plot voronoi diagram edges with one endpoint at infinity.
} while (nex != this);
// plot delaunay triangle edges and finite VD edges.
- Stack edges = new Stack();
+ LinkedList edges = new LinkedList();
Hashtable seen = new Hashtable();
pushRing(edges, seen);
System.out.println("no. of edges = " + edges.size());
- while (!edges.empty()) {
+ while (edges.size()!=0) {
Edge edge = (Edge)edges.pop();
- Boolean b = (Boolean)seen.get(edge);
- if (b != null && b.booleanValue()) {
+ Integer b = (Integer)seen.get(edge);
+ if (b != null && b.intValue()==1) {
Edge prev = edge;
nex = edge.oNext();
do {
System.out.println("Vedge " + vv1.toString() + " " + vv2.toString());
}
}
- seen.put(prev, new Boolean(false));
+ seen.put(prev, new Integer(0));
prev = nex;
nex = nex.oNext();
} while (prev != edge);
}
}
- /*
- void pushRing(Stack stack, Hashtable seen)
+
+ void pushRing(LinkedList stack, Hashtable seen)
{
Edge nex = oNext();
while (nex != this) {
if (!seen.containsKey(nex)) {
- seen.put(nex, new Boolean(true));
+ seen.put(nex, new Integer(1));
stack.push(nex);
}
nex = nex.oNext();
}
}
- void pushNonezeroRing(Stack stack, Hashtable seen)
+ void pushNonezeroRing(LinkedList stack, Hashtable seen)
{
Edge nex = oNext();
while (nex != this) {
}
nex = nex.oNext();
}
- }*/
+ }
}
* Set to true to print the voronoi diagram and its dual,
* the delaunay diagram
**/
- //private static boolean printResults; // = false;
+ private boolean printResults; // = false;
public TestRunner(int npoints) {
this.points = npoints;
//this.printMsgs = false;
- //this.printResults = false;
+ this.printResults = true;
}
public static void main(String[] args) {
System.out.println("Total time " + (end1-start0)/1000.0);
System.out.println("Done!");
- /*if (printResults)
- edge.outputVoronoiDiagram(); */
+ if (printResults)
+ edge.outputVoronoiDiagram();
// if (printMsgs) {