Three-dimensional interaction of interplanetary shock waves with the bow shock and magnetopause - A comparison of theory with ISEE observations