The Mathematics of the Heavens and the Earth: The Early History of Trigonometry