I have always been trying to find code in Matlab that enables one to smoothly connect arbitrary points in 2d or 3d with a smoothness condition and until recently couldnt find anything. We covered the theory in one of my classes and after working through it and some searching on the net I found a free open license C# version on codeProject.com.
This is my Matlab version taken from there with the addition that it can be applied to points in any dimensions. The smoothness condition is simply the requirement that the first and second derivatives be equal at the joins of each segment. This does not guarantee that there will be no loops. A better version would make the smoothness requirement on the curvature.
If there is enough of a demand I will create a function that uses curvature conditioning. In the meantime however the code works well on most nicely chosen set of data points meaning that it is useful for design, not analysis.
Aaron Wetzler (2022). Connecting a set of points with smoothly connected cubic Bezier segments (https://www.mathworks.com/matlabcentral/fileexchange/26090-connecting-a-set-of-points-with-smoothly-connected-cubic-bezier-segments), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!