docs: def draw_plane_wave_3d(ax, beam, dist_to_center=0):
      """Draw the polarization of a plane wave."""
      Ex = []; Ey = []; Ez = []
  
      k = [cos(beam.phi)*sin(beam.theta),
           sin(beam.phi)*sin(beam.theta),
           cos(beam.theta)]
      kx, ky, kz = k
  
      Nt = 1000
      tstep = 7*pi/4/(Nt-1)
  
      alpha = beam.alpha
      beta = beam.beta
      phi = beam.phi
      theta = beam.theta
      omega = 1
  
      for i in range(Nt):
          t = i*tstep
  
          Ex += [(cos(2*alpha)*cos(phi)*cos(theta) -
                  sin(2*alpha)*sin(phi))*cos(omega*t)*cos(2*beta) -
                 (cos(phi)*cos(theta)*sin(2*alpha) +
                  cos(2*alpha)*sin(phi))*sin(omega*t)*sin(2*beta) -
                 dist_to_center*kx]
  
          Ey += [(cos(2*alpha)*cos(theta)*sin(phi) +
                 cos(phi)*sin(2*alpha))*cos(omega*t)*cos(2*beta) -
                 (cos(theta)*sin(2*alpha)*sin(phi) -
                 cos(2*alpha)*cos(phi))*sin(omega*t)*sin(2*beta) -
                 dist_to_center*ky]
  
          Ez += [-cos(omega*t)*cos(2*alpha)*cos(2*beta)*sin(theta) +
                 sin(omega*t)*sin(2*alpha)*sin(2*beta)*sin(theta) -
                 dist_to_center*kz]
  
      ax.plot(Ex, Ey, Ez, beam.color+'-')
      ff = dist_to_center-1.0
  
      arrx = [-kx*dist_to_center, -kx*ff]
      arry = [-ky*dist_to_center, -ky*ff]
      arrz = [-kz*dist_to_center, -kz*ff]
      arrow = Arrow3D(arrx, arry, arrz, mutation_scale=20,
                      lw=1, arrowstyle="-|>", color=beam.color)
      ax.add_artist(arrow)
      ax.plot([Ex[-1]], [Ey[-1]], [Ez[-1]], '.', markersize=8, color=beam.color)