Curves.Spline.Type.CatmullRom (curves v0.2.5)

Copy Markdown View Source

An implementation of the Catmull-Rom spline.

Similar to [Curves.Spline.Type.Hermite], except that the derivative of each point is the slope of the previous and next point.

This makes a smooth, C1 continuous spline.

curve = Curves.define_catmull_rom([
  {0, 0},
  {1, 0},
  {1, 1},
  {0, 1},
  {0, 2},
  {1, 2},
])

for i <- 0..1000 do
  Curves.solve!(curve, i / 1000)
end
|> # render_vega_lite_chart(...)

Catmull-Rom Spline