d3 / d3-shape

Graphical primitives for visualization, such as lines and areas.
https://d3js.org/d3-shape
ISC License
2.47k stars 304 forks source link

How does Catmull Rom work with a Bézier curve? #196

Closed pspeter3 closed 2 years ago

pspeter3 commented 2 years ago

This isn’t an issue as much as a question. Every article I’ve read about Catmull Rom interpolates all the points in between but this implementation uses the Bézier curve function on Path2D / Canvas. How does that work? Thank you in advance for your time / explanation.

Fil commented 2 years ago

It's a good question :)

https://github.com/d3/d3-shape/blob/289b6ca78ba2fdde523737651866405ec6035587/src/curve/catmullRom.js#L10 implements equation (2) of the paper indicated in #18.

pspeter3 commented 2 years ago

Thank you so much! I'll check out the paper.