// Make a temple shape - a floor, four columns, and a roof. // Get the external modules we need. import 'math' // For pi import 'shape' include 'plotter' include 'plotPostscript' // Define dimensions of our viewing window. int width=200,height=200; shape.setWindowSize(width,height); // Set up a PostScript file to render shapes into file output = fileOpen("temple.ps","w"); // Create output file plotPostscript pps = (output, width, height); // Add Postscript plotter plotter = pps; // Add plotter interface double colRadius = 15, colHeight=100; // column dimensions double colOffset = 1.5*colRadius; // How far column is from edge to columnAt(double x,y,z) into (shape.cylinder column) /* Create a column with base centered at x,y,z of given height */ { column = (colHeight, colRadius, 6); column.rotateX(math.pi/2); column.move(0,colHeight/2,0); column.move(x,y,z); } /* Create a simple temple shape - a floor slab * supporting 4 columns, which support a pyramidal roof. */ array of shape.shape temple = (); shape.slab floor = (200,20,200); floor.move(0,-90,0); temple.append(floor); temple.append(columnAt(-100+colOffset, -80, -100+colOffset)); temple.append(columnAt(100-colOffset, -80, -100+colOffset)); temple.append(columnAt(100-colOffset, -80, 100-colOffset)); temple.append(columnAt(-100+colOffset, -80, 100-colOffset)); shape.pyramid roof = (75,200); roof.rotateX(math.pi/2); roof.move(0, 20, 0); temple.append(roof); /* Draw it. */ for (shape in temple) shape.draw(plotter);