# How to increase control points without changing shape?

Hi all.

Given a simple nurbs curve (uniform, normal weights), how can I increase its control points count without changing the shape?
With SubD, for example, we have _Subdivide

that double up the amount of control points (in each direction, so 4 times the faces), and it’s perfect!

I only managed to do the same trick with closed degree 3 nurbs curves, but what about open curves?
What about other degrees?
There is a rhinocommon method somewhere for this?
(Rebuild is not a solution here…)

My understanding is that you can always add a knot, which will increase the number of control points by one, without changing the shape.

2 Likes

InsertKnot doesn’t change the shape of objects.

2 Likes

For degree 3 periodic curves you can do some sort of weighted average and create a new curve with twice the amount of control points with the same exact shape, and it’s already uniform.
From blue to red:

Inserting knots works, but the resulting curve is no longer uniform. I need it to be uniform…

Hi Riccardo - Increasing the degree with `ChangeDegree` will work up to a point - higher than 7 or so, curves can become a little hard to work with, depending on what you want to do, because the spans have so many points. I stop at 5 as a rule, myself.
`InsertKnot` has an Automatic option which should keep things uniform if they start out that way. All spans will be divided. The ‘MidPoints’ option allows you to snap to locations per span that keep things near uniform - `MakeUnfiorm` will usually not change the shape much if you use mid points.

-Pascal

2 Likes

Hi Pascal.
I do not need to change the degree here… I hope…

Same here… degree 5 is plenty for everything i do…

I wondered if I should tag this “meta” or else.
I’m not strictly after a rhinocommon method.
In the image i posted above, I obtain an exact copy of the original curve by doing a trick of using alternatively control points at the mid of original control polygon and a control point averaged at 1/4 of the segments near each vertex of the control polygon.
This works only for degree 3 periodic.

There is some similar geometrical approach for non-periodic degree 3 curves?

EDIT:
I see now, clicking “Automatic” while doing _InsertKnot it doubles up the amount of control points and the shape is still correct and uniform!
How to access this via rhinocommon?
(I tried averaging the parameters of grevillepoints but it’s not correct… I did it wrongly?)

1 Like

Hi Riccardo - I would look here
https://developer.rhino3d.com/api/rhinocommon/references/rhino.geometry.knotstyle

-Pascal

1 Like

I don’t recall if all this is exposed in RhinoCommon but…

Set up a new Nurbs Curve with more knots and at least the same degree. Then interpolate the original curve at the greville points of the new curve to set the control points.

1 Like

… sorry I don’t understand this…
This way the original curve never have more greville points, the control points amount don’t change… ??

1 Like

Number Knots = Number CV + Degree -1.
So the number of CV’s is determined by the number of knots and degree.

1 Like

Use Knot.InsertKnot method at parameters uniformly distributed between the existing knots.

The Automatic option of _InsertKnot uniformly inserts one knot within each span, but adding two within each span, for example, is not possible.

3 Likes

Inserting knots is the only method of increasing the number of control points without changing the shape of the curve in general.

@GregArden method is similar to or the same as how the Rebuild command in Rhino works. Unfortunately it only guarantees the new curve will match the old curve at the Greville points used for interpolation. The results are frequently “close enough” but almost always the shape of the new curve does not match the shape of the original curve.

1 Like

My opinion is that ‘changing the shape’ is basically inevitable, and accepting that, is necessary to move forward.

Now, with that being understood, what it all boils down to is ‘tolerance’ – what is the deviation tolerance?

Therefore, in my work I often will ‘rebuild’ geometries like ‘surfaces’ for example and I will have Rhino calculate the deviation. And I’m usually satisfied when the deviation is less than say 0.0003".

So, if I can get the deviation to be less than that, then I call it good and I move forward.

This other thing ppl are saying about inserting or removing ‘knots’, sure that’s fine too, but I’m personally not a huge fan of geometries that have ‘fluctuations’ in point-densities throughout their shapes, because they’re less stable and less predictable – in my opinion. Which basically means they’re ‘bound’ to deviate or ‘change shape’. Hence, inevitable.

It all depends on design intent of course.

Also, I prefer isocurves with nice uniform densities per say.

I realize some users might say curves shouldn’t necessarily have uniform point densities, but I prefer that for crvs too, because they usually give rise to the surfaces later. Although, I could just rebuild the surfaces as described above, within tolerance.

I understand and agree with your opinion.
I also often tends to rebuild. Better work with uniform, untrimmed surfaces, etc etc…

But in my case I need to simply increase the “detail” of a well-defined curve. I want it to not move, to not change.

Adding knots is good, I have no experience of using that.

Thank you! Exactly what I searched for!

1 Like

I probably got ahead of my self earlier.

These ‘insert knot’ methods look much more advanced than any I’ve ever tried.

Maybe someone could make it an eto Framework for everyone to use

Inserting knots is the only method of increasing the number of control points without changing the shape of the curve in general.

It is always possible to increase the degree and maintain the shape but I will admit it is more delicate that just changing the degree.

But my method of interpolation will reproduce the shape exactly if knots have been added and the degree is left the same.

To see that this is true notice that there is a nurbs curve of the given degree and knots that exactly matches the original ( e.g. the one you get by repeatedly inserting one of the new knots) . Now interpolation at Greville points is a linear map from n interpolation points to n control points. By the defining property of interpolation the map is one-to-one, that is two different sets of interpolation data will always produce two distinct nurbs curves. By a dimension argument using basic linear algebra this lets us conclude the map is also onto, that is any nurbs curve can be produced by interpolating at its Greville points. So this interpolation produces the initial curve with more control points.

1 Like

Increasing the degree while maintaining the shape requires introducing multi-knots (or increasing the multiplicity of existing multi-knots) at each interior knot of the original curve. The continuity of the new curve is the same as the old even though the degree has been increased, due to the interior multi-knots. The help for ChangeDegree suggests using InsertKnot instead for increasing the number of control points.

@GregArden I agree that your method of interpolation can reproduce the shape exactly if knots have been added while retaining all of the knots of the original curve,and the degree is unchanged. Alternatively there are algorithms for inserting knots into curves without changing the shape which are more computationally efficient that interpolating.