MATLAB MATLAB program for B-spline surface

AI Thread Summary
A user has successfully created a MATLAB program for calculating basis functions and plotting B-spline curves based on given x, y, z points and is now seeking to extend it for B-spline surface generation. They have outlined their approach, which involves calculating basis function values for both u and v directions and summing matrices to obtain the surface points. However, they express uncertainty about the next steps and seek guidance, mentioning a NURBS toolbox as a potential resource. Other users in the discussion request clarification on the program and express similar challenges with B-spline surfaces, indicating a need for further assistance in this area. The conversation highlights a collective interest in improving B-spline surface generation techniques in MATLAB.
roldy
Messages
206
Reaction score
2
As a class assignment, we were required to write a program that calculated the basis functions and also plot the resulting b-spline given a set of x, y, z points. I have done this and the program works.

I would, however, like to develop this further for b-spline surface generation (not a class assignment). I know that I'm very close to figuring this out. If you would like to see the b-spline curve for the given points, in line 9 of Bsplinesurface.m make sure the order array has only one value and that line 30 is uncommented and line 32 and 33 is commented.

The b-spline surface:

S(u,v)=Ʃ(j=0,m)Ʃ(i=0,n)PijNik(u)Njl(v)

S is of order k in the u direction and order l in the v direction.

The first summation is from j=0 to m. The second summation is from i=0 to n.

m and n = number of control points - 1

My understanding of the equation:
For each control point I calculate the basis function value for u for the last order using the recursive program I've developed (this works perfectly). I multiply this matrix by the control points. This results in a matrix where each row contains the x or y or z point for that basis function for each column u. I then sum this matrix column wise to arrive at an array containing a row of x or y or z points for each column u. I then take this array and multiply it by the basis function value matrix for v, of which the column are summed again.
Note:
The basis function value matrix for v is found the same way as the one for u except that I use the appropriate knot vector and order. My program returns these knot vectors as a check to make sure that when I change the order, the u and v knot vectors change.

What my code does is calculate N(u), then multiplies this by the x, y, and z array. Then sums up the columns and returns the result as the x, y and z points for the b-spline curve. Then N(v) is calculated (hence the loop where the function basisfuncbackup resides).
After this I'm not sure what to do. I know that there's a NURBS toolbox at mathworks but I would like to make this code work. Attached are the two .m files. If anyone could point me in the right direction it would be greatly appreciated.

Explanation of the code:

Bsplinesurface.m

lines 4-6: define my control points
line 9: define the order for u and v respectively
lines 13-26: calculate the basis function values for u and v (using their corresponding orders) and return this matrix. Also calculate and return the u and v knot vectors. Calculate the b-spline x,y,z points.

lines 32-40: plot the surface

basisfuncbackup:

Description of code is commented in file.
 

Attachments

Physics news on Phys.org
hi
the program of bspline dosent work
 
Hello,
I would like to know if you have already solved this problem posted here as I have the same me too. thank you very much.
 
Last edited:
Hi
please explain these program, and program of surface has problem, please help me because i need it
thanks
 
Hi
please explain these program, and program of surface has problem, please help me because i need it
thanks
 
mmmmm

mavadat said:
hi
the program of bspline dosent work

hi
please i need program for b-spline surface
can you help me
thank you
 
What is it that you're trying to do with the B-spline surfaces: just render them or do some computations with them?

B-spline curves are nothing more than machines that generate Bezier curves with a certain degree of continuity, which is determined primarily by the multiplicity of knots in the knot vector. Thus, B-spline surfaces can be seen as machines that generate Bezier surface patches with a certain degree of continuity between them in the u- and v-parameter directions.

A simple way to interact with a B-spline surface is by extracting the Bezier surface patches that make up the B-spline surface. The paper "Isogeometric finite element data structures based on Bézier extraction of NURBS" deals with a simple method of getting those Bezier elements out of the B-spline definition without having to muck about with the recursive nature of the basis functions.
 
What is it that you're trying to do with the B-spline surfaces: just render them or do some computations with them?

B-spline curves are nothing more than machines that generate Bezier curves with a certain degree of continuity, which is determined primarily by the multiplicity of knots in the knot vector. Thus, B-spline surfaces can be seen as machines that generate Bezier surface patches with a certain degree of continuity between them in the u- and v-parameter directions.

A simple way to interact with a B-spline surface is by extracting the Bezier surface patches that make up the B-spline surface. The paper "Isogeometric finite element data structures based on Bézier extraction of NURBS" deals with a simple method of getting those Bezier elements out of the B-spline definition without having to muck about with the recursive nature of the basis functions.
 
  • #10
thank you for explain
But I have a problem in non-uniform b-spline representation
can you help me in this field ?
 
  • #11
Sure, but make another thread with your question. This one needs to retire.
 

Similar threads

Replies
2
Views
3K
Replies
4
Views
1K
Replies
2
Views
2K
Replies
5
Views
1K
Replies
1
Views
2K
Replies
1
Views
12K
Back
Top