def generate_points(length=3):
 print 'Points are being generated...'
 global points, triangles, height
 size = ((2 ** length) + 1)
 points = np.indices((size, size, 1)).T[0].transpose((1, 0, 2))
 points = points.astype(np.float32)
 generate_terrain(0, (size - 1), 0, (size - 1), length)
 height = length
 points = np.resize(points, ((size * size), 3))
 points2 = np.delete(points, 2, 1)
 tri = Delaunay(points2)
 triangles = points[tri.simplices]
 triangles = np.vstack(triangles)
 print 'Points successfully generated.'

def generate_points ( length = 3 ) : print 'Points are being generated...' global points , triangles , height size = ( ( 2 ** length ) + 1 ) points = np . indices ( ( size , size , 1 ) ) . T [ 0 ] . transpose ( ( 1 , 0 , 2 ) ) points = points . astype ( np . float32 ) generate_terrain ( 0 , ( size - 1 ) , 0 , ( size - 1 ) , length ) height = length points = np . resize ( points , ( ( size * size ) , 3 ) ) points2 = np . delete ( points , 2 , 1 ) tri = Delaunay ( points2 ) triangles = points [ tri . simplices ] triangles = np . vstack ( triangles ) print 'Points successfully generated.'
generates points via recursive function and generate triangles using scipy delaunay triangulation parameters length : int number of points is generated .