Where is the Closed Crv Seam Located with Curve.CreateControlPointCurve?

I know the seam changes given the degree, but how? I’m trying to match the functionality of __CurveThroughPolyline, where the seam always matches the seam of the input polyline.

Curve.CreateControlPointCurve puts the seam on the pts[0] location for deg1, but I can’t figure out how subsequent ones are calculated.

Hi @EricM,

The seam of a closed NURBS curve can be found at NurbsCurve.Domain.Min.

The domain of a NURBS curve is determined from the curve’s order, knot vector, and control point count.

– Dale

Could you share the source for how _CurveThroughPolyline turns a poly into a crv? That’s essentially what I’m doing, but that function isn’t in RhinoCommon.

_CurveThroughPolyline always makes the output curve’s seam at (or a half step from) the input poly’s seam.

The CurveThroughPolyline can create a curve in a number of ways depending on the command line options select.

How do you use this command?

– Dale

someClosedPolyline →
_CurveThroughPolyline pause CurveType=ControlPoint Degree=5 DeleteInput=No

Hi @EricM,

That should be the equivalent of:

var rc = NurbCurve.CreateControlPointCurve(points, 5);

– Dale

Visually they are identical, but the seam moves when you specify periodic=yes.

So _CurveThroughPolyline’s source isn’t public somewhere? If not I guess I’ll start googling periodic curves to see how cps should be duplicated.

@EricM - here is the underlying magic:

ON_NurbsCurve::CreatePeriodicUniformNurbs

– Dale

I was really hoping for this source:

public class CurveThroughPolyline: Command
{
    ....
    public override string EnglishName => "CurveThroughPolyline";
    .... 

It’s re-ordering the input points somehow.

If I understand the cpp correctly, the multiplicity of the points is specified here:

for (i = 0; i <= order-2; i++)
      SetCV( m_cv_count-m_order+1+i, ON::intrinsic_point_style, CV(I) );

And order means span length, aka degree + 1, so it’s duplicating degree - 1 points? When I look at my output curve, it follows that pattern, but my question is, where is the seam? Does it fall on (degree - 1) / 2?

Hi @EricM,

The CurveThroughPolyline command is written in C++.

As I have already mentioned, the seam of a closed NURBS curve can be found at NurbsCurve.Domain.Min.

If you want/need to move the seam, use Curve.ChangeClosedCurveSeam.

– Dale