4

I am trying to write an algorithm to remove a control point from a NURBS curve, similarly to what can be achieved using the CVREMOVE command in AutoCAD.

control point removal

I searched online but I was unable to find a single article about this topic, so here I am. Thanks a lot in advance for any hint you may have!

Edit: the NURBS curve definition comes from a STEP file.

  • I don't understand why you're having a problem. How are you generating the curve to begin with? Check out this library: https://github.com/sjhalayka/catmull_rom_mandelbrot/tree/main/bspline_library – shawn_halayka Feb 27 '24 at 16:18
  • P.S. I did not make that library. I've just lost track of the original author. – shawn_halayka Feb 27 '24 at 16:18
  • Hi! Thanks for sharing the library. I am not generating the curve myself, I am reading it from a STEP file. I looked into the code you shared but it does not seem to do what I need. I'm looking for a way to remove a control point and adjust the knot vector accordingly. – Lorenzo Celli Feb 28 '24 at 08:55

1 Answers1

0

A simple effective way to do this is simply not to remove the point at all, instead compute a straight line between the points on either side of the point to be removed. Then move the point that we want removed to the midpoint of that line. Mark it as hidden and then draw everything as normal except don't draw the hidden points.

Another approach is to keep the relative distances from the two ends proportional and place the new point at the proportional distance from the other two.

pmw1234
  • 3,209
  • 1
  • 8
  • 16
  • This does not answer my question, I'm not looking for a way to move a point and 'hide it'. I'm looking for a way to remove a control point from a NURBS curve and update the knot vector accordingly. – Lorenzo Celli Feb 28 '24 at 13:24
  • Oh, well in that case you'll find the answer to you question in "The NURBS book." – pmw1234 Feb 28 '24 at 14:42
  • What chapter? I looked, but I only found information about knot removal, whereas in this case I am trying to remove a control point instead of a knot – Lorenzo Celli Feb 28 '24 at 23:51
  • How was the curve computed in the first place? This detail isn't in the question yet it is critical to answering the exact question being asked. In other words you can't just pull out 1 control point and recompute 1 knot, and the computation varies depending on how the curve was originally computed. The thing that is perplexing about this question is: how could the curve have been computed in the first place if you don't know how to compute it after removing a control point because the two operations are similar. Hence the simple answer. Good Luck. – pmw1234 Feb 29 '24 at 12:06
  • I edited the question and added that the curve comes from a step file. Why do you say 'you can't just pull out 1 control point and recompute 1 knot'? – Lorenzo Celli Feb 29 '24 at 15:16
  • 'how could the curve have been computed in the first place if you don't know how to compute it after removing a control point': the curve (control points, weights and knots) is defined in the step file. I know how to remove the control point, the question is how to update the knot vector. Which knot should I remove, should I update the other knots, and how. – Lorenzo Celli Feb 29 '24 at 15:24