/** * Gets a list of the triangles in the subdivision, * specified as an array of the triangle {@link Vertex}es. * * @param includeFrame * true if the frame triangles should be included * @return a List of Vertex[3] arrays */ public List getTriangleVertices(boolean includeFrame) { TriangleVertexListVisitor visitor = new TriangleVertexListVisitor(); visitTriangles(visitor, includeFrame); return visitor.getTriangleVertices(); }
/** * Gets the coordinates for each triangle in the subdivision as an array. * * @param includeFrame * true if the frame triangles should be included * @return a list of Coordinate[4] representing each triangle */ public List getTriangleCoordinates(boolean includeFrame) { TriangleCoordinatesVisitor visitor = new TriangleCoordinatesVisitor(); visitTriangles(visitor, includeFrame); return visitor.getTriangles(); }
/** * Gets a list of the triangles * in the subdivision, specified as * an array of the primary quadedges around the triangle. * * @param includeFrame * true if the frame triangles should be included * @return a List of QuadEdge[3] arrays */ public List getTriangleEdges(boolean includeFrame) { TriangleEdgesListVisitor visitor = new TriangleEdgesListVisitor(); visitTriangles(visitor, includeFrame); return visitor.getTriangleEdges(); }
/** * 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; }
/** * Creates {@link QuadEdgeTriangle}s for all facets of a * {@link QuadEdgeSubdivision} representing a triangulation. * The <tt>data</tt> attributes of the {@link QuadEdge}s in the subdivision * will be set to point to the triangle which contains that edge. * This allows tracing the neighbour triangles of any given triangle. * * @param subdiv * the QuadEdgeSubdivision to create the triangles on. * @return a List of the created QuadEdgeTriangles */ public static List createOn(QuadEdgeSubdivision subdiv) { QuadEdgeTriangleBuilderVisitor visitor = new QuadEdgeTriangleBuilderVisitor(); subdiv.visitTriangles(visitor, false); return visitor.getTriangles(); }
subdivision.visitTriangles(new TriangleVisitorCircumCenter(circumcenter), false); return geomCollection.getFactory().createMultiPoint(circumcenter.toArray(new Coordinate[0]));