# Computing a NURBS derivative curve

Hi,

I was wondering if OCC has a function to compute at least the first derivative curve (aka hodograph) of a NURBS curve? After hunting around web and source, I wasn't able to find the relevant code(s).

Thanks,
Demian Hi Demian,

An interesting use case! There is no ready-to-use class in Open CASCADE but you could try to do it on your own. Here's what I would start with - subclass Geom_Curve (or Geom2d_Curve) and redefine its pure virtual methods. For instance, D0() that calculates a value at a given parameter U would use underlying curve and returned it D1(), D1() would return D2() (unless you need it) and so forth.

You might want to share your code if you get it done.

Good luck.
Roman
--- Roman,

Thanks for the tip, that's what I may end up doing. I'd also need the control points, but this might actually be impossible for rational B-splines! (I'm still looking into it.)

Anyway, thanks again, and if I am able to come up with a solution and cobble together code for it, I'll post again.
Cheers,
Demian Hi Demian,

I don't know if there's a mathematical formula to compute control points (poles) for a B-Spline which is a hodograph of another, please share if you find. However you could consider a general case (not necessarily a B-Spline) and subclass Geom_Curve, not Geom_BSplineCurve.

Good luck!
Roman
--- Hi Roman,

Although this post is over a year old, I wanted to send along the information I've found on the problem. I was able to find a few different sources for computing hodograph curves, two of which stand out: the first is for NURBS curves and the second is for Bezier curves (and surfaces):

M.S. Floater. Evaluation and properties of the derivative of a NURBS curve (1992)
in Mathematical Methods in CAGD, T. Lyche
http://folk.uio.no/michaelf/papers/biri_paper.pdf

T. Saito et al. Hodographs and normals of rational curves and surfaces (1995)
in Computer Aided Geometric Design (12):417-430

The algorithms in Saito are not difficult to implement, and would work for C1-continuous B-splines by splitting the curve (or surface) into Bezier pieces, computing the individual hodographs, and then joining the Bezier hodographs back into a single B-spline. Unfortunately, I haven't implemented the algorithms in OCC, so I can't provide relevant implementations.