code: def _get_grid(size, w, h, polar=False):
      """
      Construct the grid of points.
  
      Points are choosen
      Results are cached since the grid in absolute coordinates doesn't change.
      """
      # We need to get points on a semi-sphere of radious 1 centered around (0, 0)
  
      # First step is to get a grid of angles, theta and phi ∈ (-pi/2, pi/2)
      step = np.pi / size
      start = -np.pi / 2 + step / 2
      end = np.pi / 2
      theta, fi = np.mgrid[start:end:step, start:end:step]
  
      if polar:
          # if polar=True the first frame will show points as if
          # you are on the center of the earth looking at one of the poles.
          # Points on the sphere are defined as [sin(theta) * cos(fi), sin(theta) * sin(fi), cos(theta)]
          # Then we need to intersect the line defined by the point above with the
          # plane z=1 which is the "absolute plane", we do so by dividing by cos(theta), the result becomes
          # [tan(theta) * cos(fi), tan(theta) * sin(phi), 1]
          # note that the z=1 is implied by the coord_transformation so there is no need to add it.
          tan_theta = np.tan(theta)
  
          X = tan_theta * np.cos(fi)
          Y = tan_theta * np.sin(fi)
      else:
          # otherwhise will show as if you were looking at the equator
          X = np.tan(fi)
          Y = np.divide(np.tan(theta), np.cos(fi))
      # construct the points as x, y coordinates
      points = np.vstack((X.flatten(), Y.flatten())).T
      # scale and center the points
      return points * max(h, w) + np.array([w // 2, h // 2])
  
imports: from functools import lru_cache
  import numpy
  from norfair.camera_motion import CoordinatesTransformation
  from .color import Color, ColorType
  from .drawer import Drawer
label_desc: Use image node_id 1 for calling a global function with example usage: _get_grid(size, w, h, polar) and returns: unknown