# File: surface.py # Author: Petr Sorfa # Desc: This example creates a simple 9x9 grid with some semi-random # surface protrusions. A Python function is used to create the # surface. import am import math #----------------------------------------------------------------------------- # make_surface function for creating a simple surface grid with semi-random # surface bumps #----------------------------------------------------------------------------- def make_surface (): am.surface_begin() for i in range(1, 10): # Loop value from 1 to 9 row = [] for j in range(1, 10): # Loop value from 1 to 9 k = math.sin(i*j)/2.0 # Calculate the height row += [j, k, i] am.surface_add(row) am.surface_end() #----------------------------------------------------------------------------- # Main program #----------------------------------------------------------------------------- am.begin() make_surface() am.end()