I wanted to share a method I recently discovered to reduce the degree of a NURBS curve/surface from its end/side while still maintaining G2 continuity at that end/side.
For a curve, where d1 is the (lesser) degree of the resultant curve,
- Through quantity d1+1 of the same control point locations of a starting single-spanned, non-rational curve, including the end to have G2 continuity, create a single-spanned _Curve Degree=d1.
- From the end control point where G2 continuity is to be kept, scale the curve, or at least the 2nd and 3rd control points, at a scale factor determined by this Python routine:
scale = 1.0
for i in range(nc_From.Degree-1, iDeg_To-1, -1):
scale *= (float(i)**2 - 1.0) / (float(i)**2)
The resultant curve will share G2 continuity at the end with the original curve. Per _CurvatureGraph, It may even appear to be G3, but it probably is not quite.
For example, to convert degree 5 to 4, the scale factor is 15/16
Degree 4 to 3: Scale factor is 8/9
Degree 5 to 3: 15/16 * 8/9 = 5/6
A degree-7 curve reduced to degree-5, 3, and 2:
Also,
- To use this method on a surface, apply the above curve method to the rows or columns of control points, scaling each row or column about its end control point.
- Additional scaling is required for converting from/to multi-spanned curves/surfaces with simple knots.
- Additional scaling is required for rational curves. Unfortunately, maintaining G2 continuity on a rational surface seems to require more than a single scale factor.
One scenario for using this method is to _ExtendSrf Merge=No, then convert the extension surface to a lesser degree.
Here are a couple of scripts that use this method to create single-spanned curves/surfaces:
3 posts - 2 participants