How to build a spline from control points?

I am new to OCC. I searched the document and found many ways to build a spline, but I cannot find a way to build a spline from control points, anybody can help? Thanks.

Pawel's picture


try this.
I assume that you have your control points, weights and knots in arrays: inp, W and knots.

just remember the golden rule: m = n + p + 1
m+1 - number of knots
n+1 - number of control points
p - degree of the curve

a hint: the knot vector has always (p+1) first and last values set to
0 and 1 respectively (could actually be different but let's not make
our life harder). this assures that the nurbs is a clamped one.
additionally make sure that knot[i]<=knot[i+1].
Weights can be set to 1 at the begining.

#define T 3
#define N 7

iTColgp_Array1OfPnt Poles (1,N+1);
TColStd_Array1OfReal Weights (1,N+1);
TColStd_Array1OfReal Knots (1,N-T+3);
TColStd_Array1OfInteger Multiplicities (1,N-T+3);


Pawel's picture

forget the 'i' by the declaration of 'Poles'