coding UTF-8; // Required to handle 3D graphs import tool.Graph3D; // Write sample coordinate data to file (WRITE_TSV means tab-separated format) int file = open("sample3d.txt", WRITE_TSV); for(int yi=0; yi<=10; yi++){ for(int xi=0; xi<=10; xi++){ float x = xi * 0.4 - 2.0; // from -2.0 to 2.0 float y = yi * 0.4 - 2.0; // from -2.0 to 2.0 float z = y*y - x*x; writeln(file, x, y, z); // Write "x y z" to a line } writeln(file, ""); // Insert a blank line to separate rows } close(file); // Launch the 3D graph int graph = newGraph3D(); // Plot the file on the 3D graph setGraph3DFile(graph, "sample3d.txt"); // Set plot options setGraph3DOption(graph, "WITH_POINTS", false); // Disable point plot setGraph3DOption(graph, "WITH_MESHES", true); // Enable mesh plot setGraph3DOption(graph, "WITH_MEMBRANES", true); // Enable surface plot