/** * Writes a triangle in ASCII. * * @param writer The file we want to write in. * @param triangle The triangle to write. */ private static void writeASCIITriangle(final BufferedWriter writer, final Triangle triangle) { try { // Write facet normal : to begin a triangle with writing its normal. String s1 = "\nfacet normal"; s1 += " " + triangle.getNormal().x + " " + triangle.getNormal().y + " " + triangle.getNormal().z; // Write outer loop : to begin to write the three points. writer.write(s1 + "\nouter loop"); // Write the three points. for (final Point p : triangle.getPoints()) { writer.write("\nvertex" + " " + p.getX() + " " + p.getY() + " " + p.getZ()); } // Write the end of the facet. writer.write("\nendloop\nendfacet"); } catch (final java.io.IOException e) { e.printStackTrace(); } }