code: def generate_terrain(r_min, r_max, c_min, c_max, disp):
      """Recursively generates terrain using diamond-square algorithm
      and stores the vertices in points
      """
      a = points[r_min, c_min, 2]
      b = points[r_min, c_max, 2]
      c = points[r_max, c_min, 2]
      d = points[r_max, c_max, 2]
  
      r_mid = (r_min + r_max) // 2
      c_mid = (c_min + c_max) // 2
  
      e = (a + b + c + d) / 4 + np.random.uniform(0, disp)
  
      points[r_mid, c_mid, 2] = e
  
      points[r_min, c_mid, 2] = (a + b + e) / 3 + np.random.uniform(
          0, disp
      )
      points[r_max, c_mid, 2] = (c + d + e) / 3 + np.random.uniform(
          0, disp
      )
      points[r_mid, c_min, 2] = (a + c + e) / 3 + np.random.uniform(
          0, disp
      )
      points[r_mid, c_max, 2] = (b + d + e) / 3 + np.random.uniform(
          0, disp
      )
  
      new_disp = disp * (2 ** (-0.5))
  
      if r_mid - r_min > 1 or c_mid - c_min > 1:
          generate_terrain(r_min, r_mid, c_min, c_mid, new_disp)
      if r_max - r_mid > 1 or c_mid - c_min > 1:
          generate_terrain(r_mid, r_max, c_min, c_mid, new_disp)
      if r_mid - r_min > 1 or c_max - c_mid > 1:
          generate_terrain(r_min, r_mid, c_mid, c_max, new_disp)
      if r_max - r_mid > 1 or c_max - c_mid > 1:
          generate_terrain(r_mid, r_max, c_mid, c_max, new_disp)
  
file_path: vispy/examples/demo/gloo/terrain.py
imports: from vispy import gloo
  from vispy import app
  from vispy.util.transforms import perspective, translate, rotate
  import numpy
  from scipy.spatial import Delaunay
label_desc: Use image node_id 1 for calling a global function with example usage: generate_terrain(r_min, r_max, c_min, c_max, disp) without return types