What would ChangeClosedCurveSeam equivalent for Polyline?


I would like to ask if someone has equivalent method for a Polyline as Curve.ChangeClosedCurveSeam method so that I would not need to cast back and forth?

  public Polyline ChangeClosedPolylineSeam(Polyline polyline, double t){
    Polyline tempPolyline;
    Curve curve = polyline.ToNurbsCurve();
    curve.TryGetPolyline(out tempPolyline);
    return new Polyline(tempPolyline);

Hi Petras,

Haven’t tried this, but as a polyline is essentially just a list of points, could you do some sort of “shift list” with the points? Not sure if that would be any easier/faster.

You can also use Rhino.Geometry.PolylineCurve.ChangeCloseCurveSeam() which might be faster, dunno…


Yeah, @Helvetosaur’s idea is what I’d do too. If the parameter is an integer k, then you just have to copy the points at and after k into position 0 of a new list, and the points from 1 to k directly after.

If however the seam parameter has a non-integer part, then you will also have to split the appropriate segment into teo, yielding a polyline with more vertices.

1 Like