MATLAB program for B-spline surface

Click For Summary

Discussion Overview

The discussion revolves around the development of a MATLAB program for generating B-spline surfaces, building upon an existing program that calculates B-spline curves. Participants explore the implementation details, seek assistance with issues encountered, and discuss related concepts in B-spline and NURBS surfaces.

Discussion Character

  • Exploratory, Technical explanation, Debate/contested, Homework-related

Main Points Raised

  • One participant describes their progress on a MATLAB program for B-spline surface generation, detailing the mathematical formulation and the structure of their code.
  • Several participants express difficulties with the B-spline program, indicating that it does not work as intended.
  • Another participant requests clarification on the program and expresses urgency in needing assistance.
  • A suggestion is made to consider NURBS surfaces as a more general alternative, with a reference to an article that could be adapted for MATLAB.
  • One participant questions the specific goals regarding B-spline surfaces, asking whether the focus is on rendering or computation.
  • Another participant mentions a problem with non-uniform B-spline representation and seeks help in that area.
  • There are repeated requests for explanations and assistance, indicating a lack of clarity or understanding among some participants.

Areas of Agreement / Disagreement

Participants generally express uncertainty and face challenges with the B-spline program, with no consensus on solutions or approaches. Multiple competing views on how to proceed with B-spline surfaces and related concepts are present.

Contextual Notes

Some participants mention specific lines of code and mathematical formulations, but there are unresolved issues regarding the functionality of the program and the clarity of the explanations provided.

Who May Find This Useful

Individuals interested in B-spline and NURBS surface generation in MATLAB, as well as those seeking to understand the underlying mathematical concepts and programming challenges associated with these topics.

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 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
7K
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
12K