[PythonCAD] NURBS stuff

Art Haas ahaas at airmail.net
Thu Oct 23 12:21:33 EDT 2003


Using the links I've posted and some sent to me I've found some good
starting info on NURBS. I've written a some Python code to generate
the basis functions and plot out the points on the curves, and having
made the plots (in Gnuplot) they look more-or-less correct. My method of
calculated the basis functions is recursive, and I've spent a good bit
of time trying to do the calculations in a non-recursive manner as well.
I'm just not getting the non-recursive stuff to work at all, and some of
the code examples I've found haven't been helpful. The code is in C, and
the author hadn't considered many potential condtions in the code, like
if the knots are duplicated. This, by the way, can lead to
divide-by-zero errors, so if you don't catch this the code will crash.

There is still much more to be done with adding NURBS to PythonCAD, not
the least of which is figuring out some way to interactively create
them. I can see adding the control points by clicking on the drawing
area, but I'm not clear on how to add the knots. Also, adjusting the
weights of the control points is still a mystery. Can anyone post a few
comments about programs they have used handle creating this sort of
thing? How does AutoCAD do it, or how to other CAD packages do it? As
NURBS are used in many animation or other drawing programs, how are they
created in those programs as well?


Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822

More information about the PythonCAD mailing list