Using Swift implement of Philip J. Schneider's "An Algorithm for Automatically Fitting Digitized Curves"
Adaptively fit a set of 2D points with one or more cubic Bezier curves.
And the Swift implementations refer to fitCurves and the original C++ code.
And the Demo app refer to LxThroughPointsBezier