Flexible Spline Framework - in progress

I finally have some consistent results from my work on splines. I’ve created what can be described as a Spline Framework. With it, I can create a wide variety of polynomial-based splines. This includes

  • Cubic Bezier Spline
  • Cubic Hermite Spline
  • Cubic B-Spline
  • Cubic Tensioned B-Spline (with tension parameter)
  • Cubic Beta Spline (with beta1 and beta2 parameters)
  • Cubic Catmull-Rom Spline (with tension parameter)

This demo shows

  • Hermite: Teal
  • Bezier: Red
  • B-Spline: Blue
  • Tensioned B-Spline (tension varies Blue to Black)
  • Catmull-Rom (tension varies Green to Yellow)

Any of these splines can be created in 1, 2, or 3 dimensions (or more) from the same code. Output can be in any form desired with very little temporary memory allocated by using JavaScript generators instead of creating large temporary arrays.

I’m still working on making it easy to use, but it’s coming along well.

4 Likes

Excellent dude! This is cool!

Here’s an update to see how fast the calculations are.

Each point moves along it’s own CatmullRom Spline (tension=1) updated each render frame.

And on every frame, all twelve spline meshes are updated using the new points.

Inside the Spline class, I split up the point calculation and the matrix setup. The setup matrices only need to be recalculated when the “t” parameter exceeds 1. When that happens, a new random point is added to the spline’s input points and the first point is shifted off.

1 Like

An update with buttons to modify

  • number of control points
  • number of tesselation points, and
  • open/closed

This is showing off only

  • Cubic CatmullRom with tension parameter
  • Cubic Tensioned BSpline
  • Cubic BSpline (without tension)

All points are constantly moving in 3d space and each spline is regenerated every frame.

The points are each moving along a randomly generated CatmullRom spline.

3 Likes