SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit

Utilities for working with 2D Bsplines. More...
#include <qtBSpline2D.h>
Static Public Member Functions  
static std::vector< double >  uniformKnotVectorForInterpolatedEndpoints (std::size_t nn, std::size_t maxDegree=3, std::size_t *actualDegree=nullptr) 
Return a knot vector that, given a sequence of nn control points, will produce a spline of degree \ a dd (or lower) that interpolates its endpoints. More...  
static bool  insertKnot (std::size_t kk, std::size_t ll, double tt, std::vector< double > &knot, std::vector< QPointF > &controlPoint) 
Insert a knot value, tt, at location ll in a spline of order kk. More...  
static bool  splineToCubicPath (std::size_t degree, const std::vector< QPointF > &controlPoints, const std::vector< double > &knotVector, std::vector< QPointF > &outputPath) 
Insert knots into a cubic (or lower) degree spline to get cubic (or lower) Bezier points out. More...  
Utilities for working with 2D Bsplines.
These methods are used by smtk::extension::qtResourceDiagramArc to convert a Bspline control polygon that interpolates only its endpoints into a set of cubic Bézier points (since the latter is what Qt can render).

static 
Insert a knot value, tt, at location ll in a spline of order kk.
This algorithm modifies the passed knot and controlPoint vectors; on output, knot will include an additional value and controlPoint will contain an additional point.
If you attempt an insertion that causes a nonmonotonic knot vector, this method will return false and make no changes to knot and controlPoint.
Note that kk = degree + 1, so if your curve is cubic, kk will be 4.

static 
Insert knots into a cubic (or lower) degree spline to get cubic (or lower) Bezier points out.
If the input degree is too high, false is returned.
This repeatedly calls insertKnot on a copy of controlPoints and knotVector to determine the output path points. An alternative to repeated invocation of the Boehm insertKnot algorithm would be to implement the Oslo algorithm[1], but it is more complex.
[1]: Cohen, Lyche, and Riesenfeld. Discrete BSplines and Subdivision Techniques in ComputerAided Geometric Design and Computer Graphics. Computer Graphics and Image Processing, v14n2. October, 1980. Academic Press.

static 
Return a knot vector that, given a sequence of nn control points, will produce a spline of degree \ a dd (or lower) that interpolates its endpoints.
An empty vector indicates that nn < 2.
Example: if dd is 3 (a cubic spline is desired), then: