4.5

4.5 | 8 ratings Rate this file 197 downloads (last 30 days) File Size: 7.67 KB File ID: #14247

NURBS

by Daniel Claxton

 

12 Mar 2007 (Updated 14 Mar 2007)

No BSD License  

Converted NURBS toolbox

Download Now | Watch this File

File Information
Description

The NURBS toolbox, created by Mark Spink, is a very useful tool. However, some of the routines were written in C. This is not necessarily a bad thing as long as you know how to compile them to mex files for your machine. If you don't want to mess with mex files, or you want to be able to edit the code and don't know anything about C, I've rewritten the C code in MATLAB. You can find the original toolbox at
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=312&objectType=file

The included files replace the following mex files with the m-file equivalent.

basisfun
bspeval
bspdegelev
bspderiv
bspkntins
findspan

In addition, I've included the translated C code in the comments, line for line.

This does not include every file in the NURBS toolbox, just the mex files. You will still want to download the toolbox and replace the mex files with the included files.

MATLAB release MATLAB 7.3 (R2006b)
Other requirements NURBS Toolbox http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=312&objectType=file
Zip File Content  
Other Files bspderiv.m,
bspeval.m,
bspkntins.m,
findspan.m,
basisfun.m,
bspdegelev.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (11)
20 Mar 2007 Aslak Grinsted

I was thinking of doing just what you have done only last friday.. Excellent to find that it already has been done. thanks

01 Jun 2007 Van Brackin

THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU

I was having a conniption when I couldn't get Mark Spinks' programs to run compiled.

03 Dec 2007 Andre Lutz

Very good!

But there is a mistake in nrbcoons:
If you add

hold on
nrbplot(crv1,48);
nrbplot(crv2,48);
nrbplot(crv3,48);
nrbplot(crv4,48);

before the nrbcoons command in democoons, you will see that the coons surface does not match the curves.
Fix it with replacing line 82 in nrbcoons with:

t = nrb4surf(u1.coefs(:,1), u2.coefs(:,1), u1.coefs(:,end), u2.coefs(:,end));

29 Apr 2008 Martin Lo

This is great! Thank you so much!!! I just wasted 3 hours trying to compile the c files to mex files. The Matlab mex function is very buggy. Thanks so much!

17 Jul 2008 Richard li

great job! Thanks

28 Mar 2009 sheethal

I am finding several problems with this code:
1. When we increase the weights, the curve should get pulled toward the control point. But, it is moving away from the curve and vice versa

2. democurve.m hangs and MATLAB crashes. Just running it without any modification does so.

14 Apr 2009 Jesper

I've had the same problems with the weights and fixed it in this way:
In bspeval.m between line 45 and 46, I've inserted:
for i=0:d
   N(i+1) = N(i+1)*c(4,tmp1+i);
end
N = N / sum(N);

This code applies the weights, but there is still a problem with nrbplot.m, but this is fixed by changing line 101 from
p = nrbeval(nurbs,linspace(0.0,1.0,subd));
to
[p, ggg] = nrbeval(nurbs,linspace(0.0,1.0,subd));

Where ggg is some variable, which isnt used afterwards.

Besides these small errors, this code is great. Maybe there are more error, but this works for me for now.

24 Aug 2009 haidi

The link to the original NURBS library no longer works.
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=312&objectType=file

Could anyone could upload it again? Thanks

01 Sep 2009 Di Xiao

Cannot find the original NURBS Toolbox

07 Oct 2009 Eric Trautmann

I found a copy of the NURBS toolbox (for 2006b) here:

http://webscripts.softpedia.com/script/Scientific-Engineering-Ruby/Mathematics/nurbs-33691.html

Does anyone know if there's a newer version of this?

06 Nov 2009 Ocean Yang

Great work!

However, I find a problem in computing the first derivatives for B-spline curves/surfaces with inner multiple-knots, e.g., [0 0 0 0.5 0.5 1 1 1].

When I evaluate the first derivatives at u=0.5, it seems wrong.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
approximation Daniel Claxton 22 Oct 2008 09:04:02
interpolation Daniel Claxton 22 Oct 2008 09:04:02
non uniform ration bsplines Daniel Claxton 22 Oct 2008 09:04:02
bspline Daniel Claxton 22 Oct 2008 09:04:02
nurbs Daniel Claxton 22 Oct 2008 09:04:02
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com