Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MATLAB program for B-spline surface

  1. Feb 10, 2012 #1
    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.
     

    Attached Files:

  2. jcsd
  3. Feb 18, 2012 #2
    hi
    the program of bspline dosent work
     
  4. Oct 9, 2012 #3
    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: Oct 9, 2012
  5. Oct 9, 2012 #4

    chiro

    User Avatar
    Science Advisor

  6. Oct 18, 2012 #5
    Hi
    please explain these program, and program of surface has problem, please help me because i need it
    thanks
     
  7. Oct 18, 2012 #6
    Hi
    please explain these program, and program of surface has problem, please help me because i need it
    thanks
     
  8. Apr 11, 2013 #7
    mmmmm

    hi
    please i need program for b-spline surface
    can you help me
    thank you
     
  9. May 13, 2013 #8
    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. May 13, 2013 #9
    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.
     
  11. May 19, 2013 #10
    thank you for explain
    But I have a problem in non-uniform b-spline representation
    can you help me in this field ?
     
  12. May 22, 2013 #11
    Sure, but make another thread with your question. This one needs to retire.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: MATLAB program for B-spline surface
  1. Programming in Matlab (Replies: 4)

Loading...