added a boatload of Maths from Cesium project to do my splines