Cannot change the domain of a Nurbs Curve

Hello,

I have created a NURBS curve as follows:

ON_3dPointArray cvs;
cvs.Append( ON_3dPoint( 0.0, 1.50, 0.0 ) );
cvs.Append( ON_3dPoint( 0.0, 1.00, 0.0 ) );
cvs.Append( ON_3dPoint( 0.0, 0.50, 0.0 ) );
cvs.Append( ON_3dPoint( 0.0,-0.25, 0.5 ) );
cvs.Append( ON_3dPoint( 0.0, 0.50, 1.0 ) );
  
ON_NurbsCurve curve( 3, false, 4, cvs.Count() );
curve.MakeClampedUniformKnotVector();
for (int i=0; i<cvs.Count(); ++i)
   curve.SetCV( i, cvs[i] );

This code creates the correct curve. However, the domain of the curve is {0.0 , 2.0}.

I have tried to reparametrize the curve and change the domain of the curve to {0.0 , 1.0} as follows:

...
...
ON_NurbsCurve curve( 3, true, 4, cvs.Count() );
bool res = false;
res = curve.Reparameterize(1.0);
std::cout<< "Reparameterize res = " << res << std::endl;
res = curve.SetDomain(0.0,1.0);
std::cout<< "SetDomain res = " << res << std::endl;
curve.MakeClampedUniformKnotVector();
for (int i=0; i<cvs.Count(); ++i)
   curve.SetCV( i, cvs[i] );

Unfortunately, the curve’s domain remains unchanged even when the result returns true.

Reparameterize res = 1
SetDomain res = 1
Domain = { 0.00000000000000000 , 2.00000000000000000 }

Can you please suggest what I could be missing?

First create the uniform clamped knot vector, then change the domain. There is no need to reparameterize I think, just use SetDomain and your knot vector will be scaled to the new domain.

ON_NurbsCurve curve( 3, true, 4, cvs.Count() );
curve.MakeClampedUniformKnotVector();
bool res = false;
//res = curve.Reparameterize(1.0);
//std::cout<< "Reparameterize res = " << res << std::endl;
res = curve.SetDomain(0.0,1.0);
std::cout<< "SetDomain res = " << res << std::endl;
for (int i=0; i<cvs.Count(); ++i)
   curve.SetCV( i, cvs[i] );

That worked, thank you!

Where you define the KnotVector shouldn’t matter, because to create a knot vector you only require the number of cvs and degree of the curve. I guess this a restriction imposed by ON.