Curve.Rebuild periodic to minimum pointcount

Although the UI’s _Rebuild can output a periodic curve with total number of control points equal to double the curve degree, RC’s Curve.Rebuild outputs a minimum of 2*degree+1. I’ve tried various arguments but haven’t found a way for Curve.Rebuild to mimic _Rebuild at this extreme.

image

Start curve: Degree(3) PtCt(6) IsValid(True)
Rebuilt curve: Degree(3) PtCtIn(3) PtCtOut(7) IsValid(True)
Rebuilt curve: Degree(3) PtCtIn(4) PtCtOut(7) IsValid(True)
Rebuilt curve: Degree(3) PtCtIn(5) PtCtOut(8) IsValid(True)
from __future__ import print_function
import Rhino.Geometry as rg

def main():
    
    degree = 3
    
    pline = rg.Polyline.CreateInscribedPolygon(
        circle=rg.Circle(10.0), sideCount=degree)
    ncA = rg.NurbsCurve.Create(periodic=True, degree=degree, points=list(pline)[:-1])
    
    print(
        "Start curve:",
        "Degree({})".format(ncA.Degree),
        "PtCt({})".format(ncA.Points.Count),
        "IsValid({})".format(ncA.IsValid),
        )
    
    for pointCount in range(degree,degree+3):
        ncB = ncA.Rebuild(pointCount=pointCount, degree=degree, preserveTangents=False)
        print(
            "Rebuilt curve:",
            "Degree({})".format(ncB.Degree),
            "PtCtIn({})".format(pointCount),
            "PtCtOut({})".format(ncB.Points.Count),
            "IsValid({})".format(ncB.IsValid),
            )

if __name__ == '__main__': main()

Hi @spb,

Thanks, I’ve logged this limitation.

https://mcneel.myjetbrains.com/youtrack/issue/RH-66336

– Dale