what algorithm should be used to approximate a Nurbs curve to which I have control points, knots and weights to turn it into one or several bezier spans?

I know `ConvertToBeziers`

command is doing this but I’d like to know how to do this programmatically?

I’m trying to use this equation for approximating the nurbs curve:

But something is missing…

I thought maybe I need to first get the equation of the approximated nurbs curve and then somehow fit bezier spans there, but I can’t figure out how.

Any advice?

here’s my gh file.

NURBS_Approximation.gh (7.8 KB)