-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
interpolateCubic, interpolateCubicClosed, interpolateMonotone, interpolateMonotoneClosed #87
base: main
Are you sure you want to change the base?
Conversation
@danburzo if you'd like to review? |
I think I'd like to revisit the boundary conditions (section 2.2 in the Steffen paper). It seems we're duplicating the slopes at either ends by adding the reflection of |
See also d3/d3-shape#118 #52 #67 |
I had a chance to give the cited paper another look. The previous implementation in culori, and by extension, in this PR, is using the one-sided finite differences for boundary points, which is a valid approach outlined in the paper (Section 2.2). In (In the image above, the FD versions refer to 'one-sided finite differences') In particular, the finite-differences approach (blue stroke in the image below) produces curves that are closer to a linear interpolation; the new implementation (red stroke) tends to squeeze the colors at either end of the interpolation into a narrower portion: So I'm not 100% convinced the new approach produces better results... |
cubic Hermite splines ; will be useful for d3/d3-scale-chromatic#28
The difference with interpolateBasis is that this interpolator returns the exact values at the control points; with n = values.length we have:
Code adapted from https://github.com/Evercoder/culori (see Evercoder/culori#91 )