CurvesNURBS.kl¶
Functions¶
EvaluateNurbsBasis¶
EvaluateNurbsBasis ( in UInt8 order, in Float32 knots<>, in Float32 t, io Float32 N<> )
Translation of OpenNURBS’s ON_EvaluateNurbsBasis (simplified).
Modification: - t_k and k_t use the last entries of N, so N is expected to be of size order*(order+2) instead of size order*order. - We assume N to be already zeroed (KL initializes memory)
Evaluate B-spline basis functions
INPUT: order >= 1 d = degree = order - 1 knot[] array of length 2*d. Generally, knot[0] <= ... <= knot[d-1] < knot[d] <= ... <= knot[2*d-1]. N[] array of length order*order
OUTPUT: If “N” were declared as double N[order][order], then
k N[d-k][i] = N (t) = value of i-th degree k basis function. i where 0 <= k <= d and k <= i <= d.
In particular, N[0], ..., N[d] - values of degree d basis functions. The “lower left” triangle is not initialized.
Actually, the above is true when knot[d-1] <= t < knot[d]. Otherwise, the value returned is the value of the polynomial that agrees with N_i^k on the half open domain [ knot[d-1], knot[d] )
EvaluateNurbsBasis_uniformKnots¶
EvaluateNurbsBasis_uniformKnots ( in UInt8 order, in Float32 t, in SInt32 minSpanIndex, in SInt32 maxSpanIndex, io Float32 N<> )
EvaluateNurbsBasis_uniformKnots: optimizes EvaluateNurbsBasis for uniform knot cases, where knot span deltas are either 1 or 0 (at start/end). minSpanIndex and maxSpanIndex: in the range [0..degree*2-1], the indices from which the knot spans are 0 (min=0 and max=degree*2-1 if none) Timings showed that this version gives a 40% speed increase over EvaluateNurbsBasis in optimized KL