HarryStevens/d3-regression

Add intermediate points

HarryStevens opened this issue · 3 comments

Add intermediate points

The algorithm should work like:

  1. Get the start, S, and end point, E, i.e. the domain.
  2. Find the midpoint, M.
  3. Calculate the point predicted from the midpoint's x-coordinate, Mp, which you can find with [Mx, predict(Mx)].
  4. 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.
  5. Do that recursively along the line.