| ||||
|
#1
| |||
| |||
| NURBS and Polynomial Basis Functions I wonder if someone could help me. I am interested in deriving my own accurate NURBS curves and surfaces. I have found reference to the main NURBS equation, that being... C(u)=(SUM(i=0,n){w_i * P_i * N(u)_i,k})/(SUM(i=0,n){w_i * N(u)_i,k}) where: w_i - is the ith weight P_i - is the ith control point N_i,k - is the basis function k is the order of the curve (n-1?) n is the number of knots u is the position along the curve Unfortunately, I have only found complicated recursive functions for the basis function, and being an engineering programmer I avoid recursion if at all possible. My question is then, is there a non-recursive (or simple) basis function for a NURBS curve. Incidentally, the basis function for the bernstein polynomials is easy, and the sort of thing I'm looking for. Cheers, Tim B.
__________________ Open Source Marine Charting - openpilot.sourceforge.net Open Source Vessel Dynamics opendynamics.engineering.selfip.org |
|
#2
| |||
| |||
| Go on, take a walk on the wild side, try some recursion.
__________________ Andrew Mason Formsys http://www.formsys.com Maxsurf Academic http://www.formsys.com/academic/maxsurf/ |
|
#3
| ||||
| ||||
| Hi, I've been working with the same problem, but for a different purpose. Most people use Bezier or NURBS to construct a surface (ie, a hull). I, however, do not want a complete surface, but need a way to interpolate locally for each point. For me, Bernstein polynomials are a very good way of doing this because the value is the identity at the endpoints (without messing with knots). Furthermore, they're extremely quick. Before I move my code to C++, I make some trials in MATLAB. I've attached three m-files of what I use for Bezier Curves. If you don't know MATLAB, it's not hard to read. It's basically pseudocode... If you need more references I suggest mathworld.wolfram.com. Very good. -Jon |
|
#4
| |||
| |||
| Thanks, I'll give the recursive formula a shot, I was trying to err away from it as it involves messy programming, but hey ho, it's a computer, so it can cope. Cheers, I'll let you know how I get on, Tim B.
__________________ Open Source Marine Charting - openpilot.sourceforge.net Open Source Vessel Dynamics opendynamics.engineering.selfip.org |
|
#5
| |||
| |||
| Well, evidently I have been barking up the wrong tree for some time now with this problem, but there is hope for all who would like to develope their own code as there are downloads (in C) for B-splines and NURBS available from... http://www.nar-associates.com/nurbs/c_code.html having converted the NURBS code into more readable BBC Basic, I am about to start attempting to develope surfaces, then I will try to refine the algorithm for the basis functions. I am willing to distribute the Basic V code via e-mail on demand. Cheers, Tim B. Tim@MarineDesign.tk
__________________ Open Source Marine Charting - openpilot.sourceforge.net Open Source Vessel Dynamics opendynamics.engineering.selfip.org |
|
#6
| |||
| |||
| I'll code it for you. Tim, I am a software professional and I will do the code for you (for free) if you need it. |
|
#7
| |||
| |||
| The Fisher, Thanks, that is a very kind offer, but the fun part of the challenge is writing it and getting it to work myself. I am currently consolidating the B-spline surfaces by writing a basic hull design system for the RISC-OS (tm) system. Whilst not widely useable, I hope it will lay a lot of the ground-work and principles for a conversion into Fortran (either 77 or 90) and thus to a platform-independant hull design package. This is not the only use, though, it should be obvious that having defined a surface one can find any point on that surface, and also find the normal vector at that point. Knowing the surface and a normal vector we can begin to build grids for CFD. See my website for more details on this subject. So, thanks for the offer, and perhaps when I need the GUI and want to box it up, I'll contact you, but it is imperative that I work through the maths using my own routines. Many thanks, Tim B.
__________________ Open Source Marine Charting - openpilot.sourceforge.net Open Source Vessel Dynamics opendynamics.engineering.selfip.org |
|
#8
| |||
| |||
| Tim If you look at the two user polls at the top of this forum you will see the following systems - Bearboat BioDesign Carene Carlson Design Hull Designer Hull Form PolyCAD SDN HullCAO Autoship DefCar Fastship Maxsurf MultiSurf Naval Designer Prolines ProSurf Rhino SeaSolution TouchCAD In addition there are also- TRIBON (initial design module) FORAN SARC Paramarine Wolfson Shipshape Circe/MAAT Plus there are the general purpose CAD systems with good surface modelling capabilities - CATIA Solidworks Solidedge ProEngineer etc.etc. There are also a whole lot of less well known systems that have niche markets or can't get a commercial foothold. Can I politely suggest that the world doesn't really need another hull design system at the moment. What would be useful is a good meshing solution for the different CFD packages, I would encourage you to do more with this project. Ideally it would read a trimmed NURBS surfaces from an IGES file so that it would be compatible with most of the packages listed above. By the way, forget FORTRAN if you want to do a truly portable piece of software with a decent GUI. I would stick to Java or C++ only. Similarly if you want to do a platform independent program, start on Linux, otherwise do it on Windows. Do not start developing on a non-mainstream OS with a non-mainstream language (and FORTRAN is non-mainstream for commercial cross platform development), you will regret it later on when you have a huge amount of code to revise/rewrite to get your software working on another system. regards Andrew
__________________ Andrew Mason Formsys http://www.formsys.com Maxsurf Academic http://www.formsys.com/academic/maxsurf/ |
|
#9
| |||
| |||
| Oh dear, Andrew, I am only too well aware of the commercial packages available to solve this problem. I can only assume that you haven't read the 'research' page on my website, or you would have got the jist of what I am trying to do in terms of grid generation. I feel that you have mis-understood the purpose of writing the main hull-design system. The reason is purely to consolidate the B-spline (and later NURBS) surfaces into something that is at least reasonably useable. I think you would agree that there is an element of convenience about using you're own code (product or developement) because you know that it is easy to dip into and change as nescessary. The OS: To be honest I couldn't care less, I just happen to be very used to RISC-OS and fluent in its BBC Basic (just a bit faster to program) Cheers anyway, Tim B.
__________________ Open Source Marine Charting - openpilot.sourceforge.net Open Source Vessel Dynamics opendynamics.engineering.selfip.org |
|
#10
| |||
| |||
| Well at last I have a screen-shot of this, so everyone can see what I've been up to for the last few weeks. It is still only in it's elementary stages, but promises to be quite useful, if only for my own purposes.
__________________ Open Source Marine Charting - openpilot.sourceforge.net Open Source Vessel Dynamics opendynamics.engineering.selfip.org |
|
#11
| |||
| |||
| Hi guys, Is it possible with Matlab to build a surface based on 2 NURBS? I've used a CAD package for that, but the script runs for a while. I need to extract the points on the surface (conducted by 2, 3 or even 4 NURBS as bounds, to form a closed profile) equally spaced on the both main axes. In CAD packages, one can just sweep a NURBS along the other and get the surface, which is going to be intersected by 2 sets of orthogonal planes to each NURBS to get some certain x-y grid points. I'd appreciate any help. Suhoi |
|
#12
| |||
| |||
| Yes, it is possible, but it's not quite as simple as the CAD packages would make it look. I'd strongly suggest that you start with B-Splines (Which are well published and easy to calculate) then when you understand how to generate surfaces, replace the B-spline routines with NURBS routines. Do you have access to (or know) any languages other than Matlab? as Matlab is unlikely to be that fast. Cheers, Tim B.
__________________ Open Source Marine Charting - openpilot.sourceforge.net Open Source Vessel Dynamics opendynamics.engineering.selfip.org |
|
#13
| |||
| |||
| nurbs Tim, I do some MDO involving structural optimisations using matlab and some FEAs. It is handy, but I can look into another software anytime. Matlab is quite good in mathematical stuff, and has B-spline capabilities. The scripts using CAD packages are handy, but time consuming. I am anytime in the position of learning new things related to my work, but what you suggested me is not quite the straightforward way to do it. That's why I appealed to fora, maybe there's already someone creating a surface through 2-3-4 nurbs and can share his know-how with us. I'm pretty sure it's quite an easy task, and as long as you have the surface, and its equation of course, you can do whatever you want with it. But it's a long journey, and CAD scripts seem to be the only alternative at the moment. I'd appreciate any further effort in helping me out. Regards, Suhoi |
|
#14
| |||
| |||
| These cases are quite straightforward, but you are not really creating true tensor product NURBS surfaces. In the first case you can just sweep one curve along another by offsetting the co-ordinates of the first curve by the x,y,z values of the second curve. In the second case where you have 3 or 4 boundary curves, you can do this by using a Coons patch, the mathematics for which are fairly simple. It's basically a weighted blend of the four boundary curves. You should be able to find the maths fairly easily by doing a google search. have a look at http://www.integratedsoft.com/Papers/research/nurbs/ for more explanation.
__________________ Andrew Mason Formsys http://www.formsys.com Maxsurf Academic http://www.formsys.com/academic/maxsurf/ |
|
#15
| |||
| |||
| The specific examples for intergrated software are not that helpful. Theoretical construction of my model is quite simple. The question was how can we use the software's capability and features in order to get the job done. I hope someone can share some of his experiences with regard to this issue, or codes, or at least how long does it take to run ...maybe it's not worth doing that at all. I even did that sot of mesh using GAMBIT....it was about the same amount of time. I'd appreciate any further help. Regards, Suhoi |