curran / d3-area-label

A library for placing labels in areas.
BSD 3-Clause "New" or "Revised" License
75 stars 4 forks source link

Use Interpolation #16

Closed curran closed 6 years ago

curran commented 6 years ago

Closes #15

Before: image

After: image

curran commented 6 years ago

At this point the algorithm is positioning labels very well according to interpolated values, but the interpolation itself is being done in the inner loop, which is quite a bit more expensive than it needs to be. I'd like to factor out the computation of the interpolated y0 and y1 values, the interpolated values could be computed once and re-used for each test.