Minimizing NURBS CV's

I am trying to understand how to control (minimize) NURBS points. Reference the attached screen shot that has control points turned on.

  1. The two 4-point poly-lines (red and purple) are first drawn and the corner points used to create two degree-3 NURBS. One set is in X-Y plane, and the other set is in X-Z plane.
  2. Then, generate a (blue) curve from 2 views. The resulting blue curve has too many CV’s.
  3. So, rebuild that blue curve so it has 4 points, degree 3 to obtain the green curve.
    My dilemma is the green curve is not close enough in shape or position to the blue curve.

So…

  • I can increase the degree of the rebuild and/or increase the number of points, but the result is not very satisfactory without increasing the point count a lot higher.

  • Alternatively, I can move the green curve’s CV’s to adjust the green curve’s shape to get closer to the blue curve. But, in 3-space, it is hard and tedious for me to get close enough (manually). I have been exploring using Grasshopper with Galapagos to iterate the green NURBS CV positions, but have not succeeded to my satisfaction.

Are there any suggestions to use some feature(s) in Rhino to obtain a better solution?

Have you tried the _FitCrv command?

-Kevin

Try degree 5 with 6 points. I think the shape you’re looking for just can’t be a degree 3 curve (single span).

To understand why there are so many points, you have to understand what Crv2View does. It simply extrudes (projects) each of the two curves in their planar direction, finds the intersection and plots that curve. The intersection thus found needs to lie within the file tolerance of the curve projections so Rhino adds as many control points as necessary to keep the curve within the tolerance. (this is a lot like Offset)

FitCrv using the file tolerance will not change anything because the curve already has the minimum number of points needed to keep the projections within tolerance of the originals. If you lower the tolerance in FitCrv, you can have less points - at the expense of more deviation from the original.

Alternatively, you can use Rebuild and play with the degree/number of points and look at the deviation from the original. When the deviation is acceptable, finish the rebuild.

2 Likes

The output of Crv2View is always degree 3. Changing the degree of the input curves does not affect the output.

RebuildCrvNonUniform may result in a curve with fewer control points for the same or less deviation.

1 Like

I meant that try rebuilding the blue curve to degree 5 with 6 points… and the blue curve was the result of the Crv2View. @Matt3 already tried to rebuild the blue curve to degree 3 with 4 points (green curve) and I think it’s just impossible to get the shape out of the single span degree 3 curve (too much deviation).

And as far as I know the rebuild is the correct solution to this problem, but the selected settings (degree/points) was just little off.

In the case of two identical curves with same start/end + control points just rotated relative each other, there is one exact solution with degree 3 / 4 control points - but it’s only valid in this particular case.

Crv2View.3dm (1.9 MB)

Basically you project the cp’s in the normal direction of each planar curve until they intersect, then run a new single span curve through those points.

But RebuildCrvNonUniform only makes degree 3 curves. In my trials it looked like that you could get a smaller deviation and/or fewer control points using a higher degree curve which seems to concur with @jari.huuskola finding.

That is brilliant! That works great, although the new curve is still not close enough to the original in my case.

Instead, I projected the two poly-line curves (that pass through the CP’s) instead of the points themselves. Makes the order of the points on the screen more obvious for me.

I stumbled on this related thread for another approach I am interested in.
Smarter rebuild

In my case it is. If project the resulting curve (from my example file above) to the plane of either of the original curves and then run CurveDeviation, I get values of 6.83563e-13 as the max deviation. That is to say around 0.000000000001 units. That’s as close to 0 as you will ever get.

As far as tolerances go, you maybe need to read a bit here as well as on the limits of floating point math calculations. 15. Floating Point Arithmetic: Issues and Limitations — Python 3.12.0 documentation