On 15/01/2017 at 20:10, xxxxxxxx wrote:
Cinema 4D Version: R18
Platform: Mac ;
Language(s) : C++ ;
Greetings to all.
Is there any way to perform spline interpolation in C4D without creating a SplineObject?
I have a plugin that needs to reinterpolate a bunch of points along a 3D spline. I'm currently creating a bunch of SplineObjects to do this, using them to calculate the interpolated vertices without actually adding them to the scene, then throwing them away. I'm also using SplineLengthData to (approximately) interpolate uniformly across the length of the spline.
This kinda works... except it doesn't, really.
My problem is that SplineObject doesn't seem to interpolate values across the mathematical curve created by the input vertices. Instead, it appears to be interpolating values across the line object representation of that spline, similar to what you see in the viewport if the intermediary points setting is set to "uniform" and the "number" setting is exceptionally low (1 or 2). I can actually see the facets of the spline in the interpolated data, which is no good.
I have found that I can twiddle with the settings of the SplineObject to change this behaviour (exactly as you'd do for a spline object in the attribute manager), but this still doesn't solve my problem. Even if I set the intermediary points to uniform and give it an arbitrarily high value (1024 or 2048), under certain circumstances I can still see the facets of the line object SplineObject appears to be interpolating with.
Is there any way to work around this behaviour? Or am I going to have to write my own 3D spline solver library? I'd rather not re-implement a bunch of spline types C4D already supports natively, but it seems like there's no way to interpolate a curve smoothly without the subdivision settings of SplineObject affecting the results. If I am going to have to write my own 3D spline library, does anyone have any resources that would be a good place to start (or any sample code I could see)?