This project provides both the MATLAB and C++ implementaitons of the orthorgonal polynomials, including
Legendre polynomial fitting
Zernike polynomial fitting
[1] Virendra N. Mahajan, "Orthonormal aberration polynomials for anamorphic optical imaging systems with rectangular pupils," Appl. Opt. 49, 6924-6929 (2010)
[2] Liu, F., Robinson, B. M., Reardon, P., & Geary, J. M. (2011). Analyzing optics test data on rectangular apertures using 2-D Chebyshev polynomials. Optical Engineering, 50(4), 043609.
[3] Junzheng Peng, Yingjie Yu, and Haifeng Xu, "Compensation of high-order misalignment aberrations in cylindrical interferometry," Appl. Opt. 53, 4947-4956 (2014)