The raytracing process of an X-ray optical system is described
which may includes any number of mirrors and/or crystals with various figure shapes as well as aperture. The arrangement of optical elements may be coplanar or orthogonal to each other. Diffraction direction of a ray passing a crystal for symmetrical or asymmetrical reflection is calculated from the vector form of Laue diffraction equation. The raytracing program is written in C language
with which not only the ray spot diagram at any position in the optical system can be obtained but also the rocking-curve of a crystal can be calculated. Finally
as an example
the application of the program in calculating the imaging of an X-ray synchrotron radiation beamline system is demonstrated.