/** * Draw all the Delaunay edges. */ public void drawAllDelaunay() { // 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 = triangle.facets().iterator(); otherIt.hasNext();) { Set facet = (Set)otherIt.next(); Pnt[] endpoint = (Pnt[])facet.toArray(new Pnt[2]); draw(endpoint[0], endpoint[1]); } } }
/** * Report the boundary of a Set of Simplices. * The boundary is a Set of facets where each facet is a Set of vertices. * @return an Iterator for the facets that make up the boundary */ public static Set boundary(Set simplexSet) { Set theBoundary = new HashSet(); for (Iterator it = simplexSet.iterator(); it.hasNext();) { Simplex simplex = (Simplex)it.next(); for (Iterator otherIt = simplex.facets().iterator(); otherIt.hasNext();) { Set facet = (Set)otherIt.next(); if (theBoundary.contains(facet)) { theBoundary.remove(facet); } else { theBoundary.add(facet); } } } return(theBoundary); }