Laser-beam interaction in an undulator is commonly suggested in the development of free electron laser (FEL) schemes. In this paper, a three-dimensional algorithm is developed to assist in laser-beam interaction simulation in an undulator, which is built