Evaluate NurbsDeBoor

Hallo,
I am using the function ON_EvaluateNurbsDeBoor(int cv_dim, int order, int cv_stride, double *cv, const double *knots, int side, double mult_k, double t), which I have integrated (copy pasted) in the software environment of kratos in order to evaluate the shape functions of the following object:

Control Points / Control Vertices:
1,1    -1.3012,0.66285,0 W=1
1,2    -1.3012,0.66285,1.3176 W=1
2,1    -0.81015,0.76105,0 W=0.70711
2,2    -0.81015,0.76105,1.3176 W=0.70711
3,1    -0.90835,1.2521,0 W=1
3,2    -0.90835,1.2521,1.3176 W=1
4,1    -1.0065,1.7431,0 W=0.70711
4,2    -1.0065,1.7431,1.3176 W=0.70711
5,1    -1.4976,1.6449,0 W=1
5,2    -1.4976,1.6449,1.3176 W=1

Knot Vector u
1   0
2   0
3   1
4   1

Knot Vector v
1   0
2   0
3   0
4   0.5
5   0.5
6   1
7   1
8   1

Degree
u-Direction : 1
v-Direction : 2

My question is, what do I have to provide the function as cv_stride and what is mult_k? Furthermore I want to know, which way I pass the double *cv to the function? (1.CV_x, 1.CV_y, 1.CV_z, 2.CV_x,… or other?)

Thanks in advance!
Matthias

Have you read the comments in opennurbs_evaluate_nurbs.cpp?

Yes I read the comments.
I think that the cv_stride means after how many doubles in the cv-array a new control vertice starts, right? (Would be in my case 3)
To evaluate my object in v-direction (knot vector = 0,0,0,0.5,0.5,1,1,1 / CV = [(1,1);(2,1);(3,1);(4,1);(5,1)] ) I now have to choose depending on where exactly I want to evaluate my B-Spline the corresponding knots and cv’s.
If I want to evaluate at t=0.4 I would choose CV [(1,1);(2,1);(3,1)] but for the knot vector I am not sure what to pick… I just read in the comments length = 2 * (order -1) = 2 * (3-1) = 4 therefore I guess knot = (0,0,0.5,0.5).
side = +1 (because on the right hand side and interior knots)
mult_k again not sure : 2 or 3 I guess 2, because knot vectors in ON have length d+n-1 (“normally” d+n+1)
cv_dim = 3
order = 3
cv_stride = 3

This provides me the values of my shape functions (already multiplied with CVs?) and I could also map this to the physical domain by mulitplying with its weights (+CVs?)?

If I now want to have the derivatives can I use ON_EvaluateNurbsBasisDerivatives becaus it says in the comments that this function needs the input of TL_EvNurbBasis( order, knot, t, N )?

You can use ON_NurbsCurve::m_cv_stride.

If you’ve read the openNURBS headers, then you know this function is for expert users only, and we provide no support for it. Surely this is not required to read and write 3DM files, which is the purpose of the openNURBS toolkit.

With this said, why are you trying to use this function? What problem are you trying to solve?

I am trying to use the functions of OpenNURBS in order to enhance an existing multiphysical FEM-solver with isogeometric analysis. To do so, I need to evaluate my shape functions and its derivatives at specific points (Gauss Points), which I already accomplished with this toolkit. Furthermore I would like to use the function ON_EvaluateNurbsDeBoor to calculate the mapping between parameter space and physical space.
So actually your advice is to generate first an object of the type NurbsCurve and then use its member m_cv_stride as input parameter for the function?

No, this is not what I am suggesting. But, if you were evaluating a NURBS curve, then you can use ON_NurbsCurve::m_cv_stride. NURBS curves store CVs as an array doubles. The stride helps determine the pointer to the start of CV[i], for example. In most cases, stride is 3, unless the curve is rational. Then it is 4.

Hallo,

now arised another question for speeding up the calculation of multiple NURBS-function values.
Is there a way, as NURBS in fact are polynomials, to export the coefficients of the polynomials if I am calling the evaluate function on a specific knot span? Therefore I don’t have to calculate each time all shape function values new but can just evaluate a polynomial which should be much faster!

Thanks,

Matthias

@dalelear is this something you can help Mattias with?