...was initially missing the last two lines of code.
The obvious problem that needs to be fixed here is that this just keeps the same LatSpan, in number of degrees, from the new "center" point, without accounting for Mercator projection.
Need to get an actual Y value, find +/- canvas.height/4, and convert back to latitude.
ToDo: implement XToLon, YToLat, LonToX, LatToY functions.
How do I even observe this bug?
The formulas that do the lat/lon<->x/y conversion are blind to the fact that we're limited to +/- 90°. Arctan should not be a problem; it's a continuous function with asymptotes of +/- pi/2. Tan? Sure, it can have values of +/- infinity, but the probability that I'm (consistently) trying to compute the tangent of exactly +/- 90° (+/- however many multiples of 180°) is vanishingly small. And I can't imagine Javascript won't let me compute tan(something >90), `cuz well, that's just not how tan works. There's something else going on here.
I COULD just go and fix the damn bug. That's easy. But I want to dig deeper, and see how exactly things are getting broken...
I forget why I asked myself this, but it was to more fully understand... something.
...was initially missing the last two lines of code.
The obvious problem that needs to be fixed here is that this just keeps the same LatSpan, in number of degrees, from the new "center" point, without accounting for Mercator projection. Need to get an actual Y value, find +/- canvas.height/4, and convert back to latitude. ToDo: implement XToLon, YToLat, LonToX, LatToY functions.
How do I even observe this bug?
The formulas that do the lat/lon<->x/y conversion are blind to the fact that we're limited to +/- 90°. Arctan should not be a problem; it's a continuous function with asymptotes of +/- pi/2. Tan? Sure, it can have values of +/- infinity, but the probability that I'm (consistently) trying to compute the tangent of exactly +/- 90° (+/- however many multiples of 180°) is vanishingly small. And I can't imagine Javascript won't let me compute tan(something >90), `cuz well, that's just not how tan works. There's something else going on here. I COULD just go and fix the damn bug. That's easy. But I want to dig deeper, and see how exactly things are getting broken...