< Previous | Contents | Manuals Home | Boris FX | Next >
Spline Interpolator
This has nothing to do with the prior two sections! This is a convenience object that allows you to do cubic splines within Sizzle, easily and quickly, independent of anything happening in SynthEyes. For example, you might interpolate some imported data points to an entire curve. Here's a quick example:
spli = SplineInterpolator()
spli.Add(0,30) // Start adding x,y points to the interpolator
spli.Add(10, 25) // NOTE: x values should always be pre-sorted in x, low to high! spli.Add(20, 20)
spli.Add(30, 15)
Message("# " #spli " third " spli[3].u ", " spli[3].v) // Here we look at the saved points yu = spli.Interpolate(25) // And here we interpolate an intermediate value Message("xu " 25 " yu " yu) // yu will be 17.5
xu = spli.Invert(yu)
Message("Invert xu " 25 " yu " yu) // xu will be very close to 25.
As you see, it's quite simple. You can't remove or change points: create a new object instead. The Invert routine is a search, it doesn't produce exact results even on spline points. Be aware that the inverse curve is not the same as building a spline interpolator with x and y reversed.
©2023 Boris FX, Inc. — UNOFFICIAL — Converted from original PDF.