An algorithm is presented that accomplishes the optical alignment of Casseg
rain and Ritchey-Chretien astronomical telescopes. The algorithm does an it
erative comparison and minimization of the error between the ideal pattern
of the transverse aberration, TA, and the actual or measured pattern of the
TA of the telescope. The TA is obtained with a Hartmann mask placed on the
base plate of the telescope and is detected by a CCD camera near the focal
plane.