Bezier to Nurbs

  1. ConvertToBezier :grin: Not a facetious answer as I’ll explain below.

  2. A set of single span, non-rational curves or surfaces, presumably with appropriate level of continuity between them.

I sometimes have a polycurve or a polysurface which could be a single multi-span curve or multi-span surface without multi-knots or stacked control points. Currently using Match with the Merge option for curves or MergeSrf for surfaces usually resulst in more control points and more spans then the sum of the components of the original polycurve or polysurface. If a BezierToNurbs command existed which creates a multi-span curve with the minimum necessary number of spans and control points from a set of Bezier curves, or which creates a multi-span surface with the minimum necessary number of spans and control points from a set of Bezier surfaces then I would use ConvertToBezier to change the polycurve or polysurface into a set of Bezier curves or surfaces, and use BezierToNurbs to obtain the multi-span curve or surface with minimum number of spans and control points…

What is the difference between a Bezier curve and a non-rational single span curve in Rhino?

What is the difference between a Bezier surface and a non-rational single span surface in Rhino?

What reports the results of ConvertToBeziers as single span surfaces or curves?

Hi @davidcockey,

Ah yes, there is the ConvertToBeziers command, which does convert each span of a NURBS curve or surface into it’s Bezier form. In the end, however, the Bezier end up in the Rhino document as NURBS, as Rhino does not have a Bezier object.

If a Bezier curve and a non-rational single span curve with clamped end knots have the same control points, then they have the same curve geometry and normalized parameterization.

If a Bezier surface with degree (d1,d2) and a non-rational single span NURBS surface with degree (d1,d2) with clamped end knots have the same control points (bez.CV(i,j) == srf.CV(i,j)), then they have the same surface geometry and normalized parameterization.

I don’t believe Rhino has a command that does this.

– Dale

It doesn’t have a BezierToNurbs command but perhaps it should per the discussion above.

Earlier today in this thread you mentioned:

and I responded quoting the above:

You responded, I replied, etc.

Hallo,

might be that I don’t get it all cause of missing knowledge of Rhinocommon and or non native Speaker:
When Rhino is based on Rhinocommon: what command is using the function beziercurvetonurbs? What is this for? How does it work? Does it reduce the amount of controlpoints as much as I mentioned before to the minimum?

As I mention in my last reply, after the ConvertToBeziers command converts each span of a NURBS object into it’s Bezier form, the Beziers are added to the document as NURBS objects. Thus, there is no need for a BezierToNurbs Rhino command - there are no Bezier objects to pick and/or convert.

Or perhaps I am confused.

– Dale

It’s not a Rhino command, it’s a function in the RhinoCommon API (what Grasshopper is based on).

Rhino - RhinoCommon Guides

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_BezierCurve_ToNurbsCurve.htm

– Dale

@dale What is the use of the beziercurvetonurbs function if Rhino does not have specific Bezier objects? Is it used when importing geometry from other systems? I’m just curious.

i can remember reading some interesting approach by iteratively approximating the curvature with few CPs. here smarter-rebuild-nurbs-curves-and-surfaces the definition was unfortunately not posted, maybe @maje90 would be so kind?

simplifying higher degree Curves other than circles or lines is something which should be natively implemented into Rhino, i am sure thats on the wishlist of many. other software packages have “simpler” rebuild functions either.

The difference between the Bezier format and Nurbs format of your single span curve is that the Bezier form has no knot vector. Beziers are defined by just the control points. Of course making a knot list for a Bezier is trivial.

In order to evaluate or calculate with a curve, Rhino apparently needs to have the knot list in the data base. The alternative would be to treat a Bezier curve as a special case which it seems they do not want to do.

Hi @davidcockey,

Our SDKs allow you to create Beziers in memory. Thus, functions exist to convert them to NURBS if needed.

– Dale

Hallo David,

Make sure to use RemoveKnot which rearranges the control points so the shape is not changed if the continuity between spans is one degree less than the degree of the curves

works great. Two times removal of the middle knots and i get exactly the control point location of the 5x5 points deg 3 nurbs surface that I had converted to bezier. Would be great if this could be done in grasshopper automatically, but I don’t see an easy way to do that. Do you have a an idea?

Hi Dale,

I think there is still some confusion about what we want. We don’t care if the beast is called Bezier Curve or Surface or single Span unweighted nurbs or whatever. We are just interested in reversing the nurbstobezier command. I might have better called it "polysurface made from singlespan surfaces to single multispan nurbs, instead of using the word bezier.

Hi @JoergH,

Rhino’s MergeSrf command will do this. The result would have fully multiple knots everywhere.

If you inclined to use RhinoCommon, the function is Brep.MergeSurfaces.

– Dale

Hallo Dale,

thanks a lot. Is there an easy way to get rid of the fully multiple knots?

Best regards

Hi @JoergH,

Can we step back a little? I Want to understand more about what you are trying to and, perhaps more importantly, why? What problem are you trying to solve? Why did you “convert to Bezier?” Why do you want to go back? Feel free to upload any models, images, etc., that help illustrate your problem.

Thanks,

– Dale

The problem has been stated clearly and often

The basic idea is to have a function that removes fully multiple knots when those knots are not contributing anything useful and are getting in the way.

It doesn’t matter how those fully multiple knots were created. There are numerous ways that the multiple knots could be created. It could be as a result of merging, but it also could be as a result of offsetting or it could be as a result of using ExtrudeTapered. How the superfluous knots came to be is irrelevant. If the surface or curve shape remains the same (within tolerance), there should be a function to get rid of them easily.
The user can use Removeknot but that can be a long process that is both tedious and not always reliable.

Any chance you tried fit surface after merge? (It doesn’t always work) There is the command in Rhino and also Pufferfish has a component for it. You can also find it in Rhinocommon.

If the knots are truly not useful to the shape it should get rid of them I think.

Hi @jim,

That may be true. But I want to hear what problem, exactingly, this customer is having.

Thanks,

– Dale

Hi Dale,

well, to take a nurbs surface with 5x5 controlpoints, convert this to bezier, and try to reverse this process is just a sample for trying out the process. In reality we sometimes get polysurfaces, that are made of 4x4 cp “bezier” surfaces as a result from export of other software. In order to manipulate these polysurfaces - lets say modify these complete surfaces, and or fair these shapes (manually - moving cps) it is easier if we have this polysurface converted to one single nurbs surface with as few cps as possible, while not changing the shape of that surface. The alternative is to build comletely new surfaces while taking the polysurface only as a reference. But this can take weeks to perform - depending on tolerances. As we already have all the data we need, just in a wrong format this does not make too much sense.