Euclidean and Non-Euclidean Geometry: An Analytic Approach