For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

can anybody introduce data structure to Geom_BSplineSurface

Liu Zhipeng's picture

I have some requirement to develop a program using NURBS surface, so I need to transfer data into OCCT

there are 9 input parameters for the construction function of Geom_BSplineSurface class, they are

 const TColgp_Array2OfPnt&      Poles,
 const TColStd_Array1OfReal&    UKnots,
 const TColStd_Array1OfReal&    VKnots,
 const TColStd_Array1OfInteger& UMults,
 const TColStd_Array1OfInteger& VMults,
 const Standard_Integer         UDegree,
 const Standard_Integer         VDegree,
 const Standard_Boolean         UPeriodic,
 const Standard_Boolean         VPeriodic

Degree and Periodic are simple, Degree is an positive integer,  Periodic is bool.

I know the meaning of the other  variables, but I don't knwo the data structure of them, can anybody clarify them for me?

Poles are control points, for surface, it's 2D array, in Poles[i][j], what is it? Is dimension 1 for U direction or dimension 2 for U direction? if any figure, it'll be much more clear

KNots are knots, usually it's between 0 and 1, 0 for the start point and 1 for the end point. it's is the same dimension as Poles? if the start point of the Spline is the same as the first control point, the first Degree+1 KNots should be all 0, similarly the same of the last point and the last control points needs the last Degree+1 KNots to be 1. In "The NURBS Book" chapter3 equation 3.2, it's clearly defined, the length of KNots array are longer than Poles array, unless the use doesn't need the overlay of the first and the last control points to the spline points.

so the following concern is the Mults. what's its data structure? multi overlay knots would lead the spline close to the specific control point, if the multi level is more than Degree, it would collapse to an un-continue point. how do you define the data stucture in it?

now I have control points data and knots data, I want to construct a Geom_BSplineSurface, how should I organize my data to match OCCT data structure? can anybody clarify it for me?

Benjamin Bihler's picture

I cannot answer your question, but for creation of B-Spline surfaces there exists also the helper class GeomAPI_PointsToBSplineSurface. Maybe you want to have a look at it.


Nathaniel Essenberg's picture

I'll copy (part of) some code I wrote a little while back to create a Geom_BSplineSurface from my own data.

TColgp_Array2OfPnt   controlpoints{ 1, numCVu, 1, numCVv };
TColStd_Array2OfReal weights{ 1, numCVu, 1, numCVv };

std::vector<double> ku{};	// unique knot values in u dir
std::vector<double> kv{};	// unique knot values in v dir
std::vector<int>    mu{};	// multiplicity for each knot in ku
std::vector<int>    mv{};	// multiplicity for each knot in kv

int numKnotsU = static_cast<int>(ku.size());
int numKnotsV = static_cast<int>(kv.size());

TColStd_Array1OfReal    knotsU{ 1, numKnotsU };
TColStd_Array1OfReal    knotsV{ 1, numKnotsV };
TColStd_Array1OfInteger multsU{ 1, numKnotsU };
TColStd_Array1OfInteger multsV{ 1, numKnotsV };

for(int u = 0; u < numKnotsU; ++u)
	knotsU.SetValue(u + 1, ku[u]);
	multsU.SetValue(u + 1, mu[u]);
for(int v = 0; v < numKnotsV; ++v)
	knotsV.SetValue(v + 1, kv[v]);
	multsV.SetValue(v + 1, mv[v]);


I would have to spend some more time looking through stuff to remember the specifics. For example, I am not 100% sure anymore why the first and last multiplicity needed to be increased by one. But essentially, different people sometimes use (slightly) different data structures to represent nurbs. In my code, for example, it appears OCC uses a smaller array of unique knot values and a separate array of multiplicities. Others just use a single array with multiple duplicate knot values.

Maybe it helps a bit though

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.