Source and explanation at https://github.com/simon-frankau/curved-spaces/.