/** * Draw all the Voronoi edges. */ public void drawAllVoronoi() { // Loop through all the edges of the DT (each is done twice) for (Iterator it = dt.iterator(); it.hasNext();) { Simplex triangle = (Simplex)it.next(); for (Iterator otherIt = dt.neighbors(triangle).iterator(); otherIt.hasNext();) { Simplex other = (Simplex)otherIt.next(); Pnt p = Pnt.circumcenter((Pnt[])triangle.toArray(new Pnt[0])); Pnt q = Pnt.circumcenter((Pnt[])other.toArray(new Pnt[0])); draw(p, q); } } }
/** * Draw all the empty circles (one for each triangle) of the DT. */ public void drawAllCircles() { // Loop through all triangles of the DT for (Iterator it = dt.iterator(); it.hasNext();) { Simplex triangle = (Simplex)it.next(); for (Iterator otherIt = initialTriangle.iterator(); otherIt.hasNext();) { Pnt p = (Pnt)otherIt.next(); if (triangle.contains(p)) { triangle = null; break; } } if (triangle != null) { Pnt c = Pnt.circumcenter((Pnt[])triangle.toArray(new Pnt[0])); double radius = c.subtract((Pnt)triangle.iterator().next()).magnitude(); draw(c, radius, null); } } }