The most important parameters of a solid state laser for scientific and technological applications are the high brightness and small angular divergence of the output radiation. This series of two papers concerns the method of numerical optimization of the laser resonator based on a commercial head with compensation of the induced internal thermal lens. Experimentation is also used to verify optimization. The method uses quasigeometrical optics to calculate focal lenghts of correcting lenses and their position in the resonator based on the measured parameters of the thermal lens and the required parameters of the output laser beam, with subsequent diffraction refining.