The dome of the Basílica de la Virgen de los Desamparados of Valencia is an emblematic example of Valencian baroque architecture and painting. Its shape, oval or elliptical, has been the subject of controversy in various studies. The study of oval domes throughout history is a very interesting field of research because, among other things, the determination of the exact shape is important in order to conclude how it was built.We approach the problem from a new mathematical point of view, calculating the distances between the points that make up the real data cloud and the hypothetical form considered, oval or ellipse. The use of modern graphic surveying techniques, carried out with a 3D laser scanner, and computation with the powerful symbolic and numerical mathematical solver, Mathematica, has allowed us to accurately determine the shape of the dome and determine that its sections are not well-described by ellipses. A better fit is obtained assuming that sections are ovals. The programming and generalization of the mathematical method employed in this work will allow it to be applied to determine the exact geometry of other oval or ellipsoidal vaults.