kellow@rockne.helios.nd.edu (John Kellow) (03/15/91)
I am trying to convert some bezier surface patch data to NURB surface patches and I was wondering if someone could point me to a good reference on doing this (or even some examples of source code). I have a book entitled "Curves and Surfaces for Computer Aided Geometric Design" by G. Farin but I find it very technical and I don't quite see the relationship between the bezier control points and the NURB control points (and knot vectors). I think what I have is an array of control points representing bezier curves with degree up to 7. Any advice (even "its too complicated, you're wasting your time") would be most appreciated. John Kellow kellow@ndcheg.cheg.nd.edu
klassen@gvax.cs.cornell.edu (R. Victor Klassen) (03/15/91)
What you need to do is convert from Bezier surface patches to ordinary B-spline patches. Then use a 1 as the w (homogeneous) coordinate of every control point, and voila - you have a uniform rational B-spline patch. This is a special case of a non-uniform b-spline, (NURBS) so you're there. In order to do this conversion, find the matrix BZ that takes Bezier control points to monomial form, and the matrix B that takes Bspline control points to monomial form, then apply B BZ^-1 to the control points, first in one (it matters not which) dimension, and then in the other. Do this on a patch by patch basis. To find the matrices, see Farin's book or the Killer B's book (Bartels, Beatty, Barsky), and then use a symbolic manipulation package such as Maple, Macsyma, Mathematica... to compute and invert them. Normally there are some continuity constraints enforced in the NURBS world by overlapping patch control vertices, so that each new patch in a column has only one new row of control vertices. This makes them nice to manipulate, since you never have to worry about inadvertently introducing kinks. In this way a NURBS surface is generally an array of control points, with patches being specified as a subarray of the control points, with overlapping subarrays. Bezier patches, on the other hand, are really arrays in their own right, but can be optionally stored with one row/column overlap to enforce C^0 continuity. Using the above method, you get a large set of NURBS surfaces, one per patch, and they happen to line up as well as the original Bezier surface. If you want to manipulate them, it would be a good idea to put neighbouring patches together, making them overlap as far as possible by checking for control vertices that almost match and then taking (say) their average. Get it working for cubics, and then generalize if you have 7th order; higher orders aren't much harder, but it's easier to see what's going on.
jp@Apple.COM (John Peterson) (03/16/91)
John Kellow (kellow@ndcheg.cheg.nd.edu) writes: > I am trying to convert some bezier surface patch data to NURB surface > patches and I was wondering if someone could point me to a good reference > on doing this (or even some examples of source code). R Victor Klassen (klassen@gvax.cs.cornell.edu) writes: > This is a special case of a non-uniform b-spline, (NURBS) so you're there. > In order to do this conversion, find the matrix BZ that takes Bezier control > points to monomial form, and the matrix B that takes Bspline control points to > monomial form, then apply B BZ^-1 to the control points... > > [stuff about matrices and Macsyma deleted...] It's really straightforward to convert Bezier patches to NURBS - there's no need to do the basis matrix stuff. Just assign the Bezier control points to the NURB control points (if the Bezier control points don't have a rational ("W") component, set the NURB W's to 1.0). Set the NURB orders to the degree+1 of the Bezier patch. Then create the knot vectors with N zeros followed by N ones, where N = degree + 1 of the Bezier patch. For example, a cubic knot vector would be: 0 0 0 0 1 1 1 1 and for a degree seven Bezier patch use knot vectors like: 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 That's all there is to it. Cheers, jp
spencer@eecs.umich.edu (Spencer W. Thomas) (03/16/91)
A Bezier patch is a "degenerate" NURBS already. You just need a knot vector and a few 1's in the "rational" part. To wit, consider the curve case for a cubic Bezier curve: { (x0,y0,z0), (x1,y1,z1), (x2,y2,z2), (x3,y3,z3) } Use the knot vector { 0, 0, 0, 0, 1, 1, 1, 1 }, and add a 1 to each control point as its weight: { (x0,y0,z0,1), (x1,y1,z1,1), (x2,y2,z2,1), (x3,y3,z3,1) } Voila! You've now got a NURBS curve. The surface case is analogous, except you need a knot vector for each parametric direction. -- =Spencer W. Thomas EECS Dept, U of Michigan, Ann Arbor, MI 48109 spencer@eecs.umich.edu 313-936-2616 (8-6 E[SD]T M-F)