Theory for calculating the Green’s function of magnetostatic surface waves and its application to the study of spatial diffraction patterns