/** * Gets a List of {@link Polygon}s for the Voronoi cells * of this triangulation. * <p> * The userData of each polygon is set to be the {@link Coordinate} * of the cell site. This allows easily associating external * data associated with the sites to the cells. * * @param geomFact a geometry factory * @return a List of Polygons */ public List getVoronoiCellPolygons(GeometryFactory geomFact) { /* * Compute circumcentres of triangles as vertices for dual edges. * Precomputing the circumcentres is more efficient, * and more importantly ensures that the computed centres * are consistent across the Voronoi cells. */ visitTriangles(new TriangleCircumcentreVisitor(), true); List cells = new ArrayList(); Collection edges = getVertexUniqueEdges(false); for (Iterator i = edges.iterator(); i.hasNext(); ) { QuadEdge qe = (QuadEdge) i.next(); cells.add(getVoronoiCellPolygon(qe, geomFact)); } return cells; }
/** * Gets a List of {@link Polygon}s for the Voronoi cells * of this triangulation. * <p> * The userData of each polygon is set to be the {@link Coordinate} * of the cell site. This allows easily associating external * data associated with the sites to the cells. * * @param geomFact a geometry factory * @return a List of Polygons */ public List getVoronoiCellPolygons(GeometryFactory geomFact) { /* * Compute circumcentres of triangles as vertices for dual edges. * Precomputing the circumcentres is more efficient, * and more importantly ensures that the computed centres * are consistent across the Voronoi cells. */ visitTriangles(new TriangleCircumcentreVisitor(), true); List cells = new ArrayList(); Collection edges = getVertexUniqueEdges(false); for (Iterator i = edges.iterator(); i.hasNext(); ) { QuadEdge qe = (QuadEdge) i.next(); cells.add(getVoronoiCellPolygon(qe, geomFact)); } return cells; }