I have a problem with line division. I'm writing a program in JS/C++ generating KML files.
I was trying to divide a line using my own function (which is correct on cartesian space):
var part1Lon = startLon+((-startLon + endLon)/3);
var part1Lat = startLat +((-startLat + endLat)/3);
But when i visualized point [part1Lon, part1Lat] on Google Earth - and it's not on the line! (As I could have expected)
So, second attempt was to convert longitude and latitude to Mercator first, do calculations, and convert coordinates back to WGS. It produces similar result - point is not on the line.
What is correct algorithm or the correct projection for doing such operations?