public static void exportCHTsin(DelaunayTriangulation dto, String tsinFile) throws IOException { FileWriter fw = new FileWriter(tsinFile); PrintWriter os = new PrintWriter(fw); // prints the tsin file header: os.println(dto.getConvexHullSize()); Iterator<Point> it = dto.getConvexHullVerticesIterator(); while (it.hasNext()) { Point p = it.next(); os.println(String.format("%s %s", p.getX(), p.getY())); } os.close(); fw.close(); }
public static void exportTsin(DelaunayTriangulation dto, Writer writer) { PrintWriter os = new PrintWriter(writer); try { // prints the tsin file header: int len = dto.size(); os.println(len); Iterator<Point> it = dto.verticesIterator(); while (it.hasNext()) { Point p = it.next(); os.println(String.format("%s %s %s", p.getX(), p.getY(), p.getZ())); } } finally { Utils.closeQuietly(os); } }