Add intermediate points
HarryStevens opened this issue · 3 comments
HarryStevens commented
Add intermediate points
HarryStevens commented
Use adaptive resampling https://bl.ocks.org/mbostock/3795544
HarryStevens commented
Adaptive resampling source https://github.com/d3/d3-geo/blob/master/src/projection/resample.js
HarryStevens commented
The algorithm should work like:
- Get the start, S, and end point, E, i.e. the domain.
- Find the midpoint, M.
- Calculate the point predicted from the midpoint's x-coordinate, Mp, which you can find with
[Mx, predict(Mx)]
. - Compare the angle of [S, M], A1, and [S, Mp], A2. If the absolute value of A1 - A2 is less than some precision, say 2, you interpose Mp along the returned line.
- Do that recursively along the line.