Jump to content
Developer Wiki and Function Reference Links ×

Shorten Nurbs curve


BillW

Recommended Posts

I am trying to shorten a nurbs curve. There is an "ExtendNurbsCurve" function but no shorten option. I can move the start point of a nurbs curve with the following code

   curveH := CreateDuplicateObject(srcH,NIL);
   if (startoffset > 0) then begin
     curvelen := hlength(srcH);
     inPercentOfLength := startoffset / curvelen;
     if GetPointAndParameterOnNurbsCurveAtGivenLength(curveH,inPercentOfLength,px,py,pz,outParam,outIndex) then begin
       NurbsSetPt3D(curveH,0,outIndex,px,py,pz);
       resetobject(curveH);
     end;
   end;

The problem is with getting the curve alignment correct. I assume I have to set the correct knot values for curve vertex points 0 and 1 with  NurbsSetKnot(objH,curveH,0,0) and NurbsSetKnot(objH,curveH,0,1).  I can get the existing knot values with NurbsKnot(srcH,curveH,0,0) and NurbsKnot(objH,srcH,0,1) . The question is how will the knot values change - what is the relationship?

 

TIA

Bill Wood
 

Link to comment

Still trying to understand Nurbs particularly how knot values work. Still cant figure out the logic for knot values in all cases - see below (might help others understanding).

Please comment if the information is incorrect.

 

I have also noticed when I "Export to script" a nurbs curve with more than 1 piece (ie from NurbsCurveGetNumPieces and with different degree values), if imported (via the script) a nurbs curve is created for each piece. There doesn't seem to be a way of creating (via script) a multi piece nurbs curve as far as I can tell.

 

To solve my problem, I think I will have to convert the (mutli piece) nurbs curve to 3D polygons (one for each piece, grouped), create/modify the 3D polygons and convert back to nurbs.

I need the nurbs for internal workings of path based plugins.

 

 

5a25436f88cf6_nurbsstraight5.thumb.png.333ea60417f52d86de9013d1ff47e49e.png5a2543631e105_nurbsstraight4.thumb.png.94a72ea62d2ff898d31c0e8ee51aba8b.png5a254359db403_nurbsstraight3.thumb.png.3621355b6220cc567dd47b4bec4f0ce0.png5a254359503bd_nurbsstraight2.thumb.png.6c8047ff27703676ea0becff0adb880c.png5a2543569fa0d_nurbs3.thumb.png.3934e1f9e5ac575833d3242a1037336e.png5a25434d09f74_nurbs2.thumb.png.1be3f513ec3e16067ea86900799bda49.png5a254341aacc0_nurbs1.thumb.png.f64872c10c6efa034c46830b43f15707.png

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...