Optical coupling between a cavity mode and a waveguide in a two-dimensional photonic crystal