Is there a 1 dimensional CreateCatmullRomSpline type function?

Hello,

This is a general question is about optimizing my current code logic if possible.

I’ve been using CreateCatmullRomSpline to shape some of my data. The pertinent data originates in a one dimensional array which is all I am really interested in (call it y). I want to insert one data value between each existing value to double my data set but using the average of the neighbors doesn’t produce the desired smooth result.

I currently convert this data into a points array of Vector3(index, y, 0) and feed this points array into CreateCatmullRomSpline only to turn around and just pull all the Y values back out again. This produces the desired smoothing result.

Is there a more optimal way to achieve the same result using just the original one dimensional array? My math isn’t the strongest so I think I may just be missing some basic math function that does the same.

Thanks for any feedback.

TheSkrapper

I think the easiest way is to copy the source code from this function into your project and adapt it to compute only the y values:

It seems the computation of x/y/z are independent, so you can remove the ones for x/z.

1 Like