 # Curve Derivatives

Hi all,

I have been searching in the forum for days, but couldn’t really find answer to my question about CDiv (Curve Derivatives) component in Grasshopper. I understand that the 1st derivative is tangent and the 2nd is curvature. It seems like the first in the component represents correct information-parallel to tangent vector at a given point, but I don’t understand why the 2nd differs from the direction of actual curvature vector. Could someone please shed some light on it?

W

1 Like

I had the same question too. Just posting to keep the question afloat.

This is a incorrect assumption based on school math. see this:

basically what you need to do is:

get a Frenet Frame, however this can flip normals in some situations. Better is a “Bishop Frame”
Its basically a comparision between the Frenet Frame at t and a Fernet Frame at t-tinystep.
Its nothing difficult. Just simple Vector operations.

A Frenet frame at t:
tangent= normalize(N’(t))
v= normalize(tangent+ N’’(t))
r = normalize(v × tangent)
normal = normalize(r × tangent)

Edit “Bishop Frames” are also know as “Rotation Minimising Frames”

2 Likes

This is a python implementation I made some years ago:

```def getFrame(cps,t):
ders = curveDerivatives(cps,t,3)
dersOff = curveDerivatives(cps,t+0.001,2)
pt = ders
tan = nor(ders)
tanOff = nor(dersOff)
r = cro(tan,tanOff)
r = nor(r)
nrm = cro(tan,r)
return (pt,tan,nrm,r)
where "cro" is the "crossproduct" and "nor" is "normalising"```
1 Like

And this is what R can offer:

Crv_DerivativesEntryLevel_V1.gh (123.4 KB)

1 Like

Tom,

Thank you for the good explanation. Please excuse my lack of knowledge on differential geometry, but is it fair to say that a curvature vector that we are given from a gh component is just an approximation or just for visualization purpose?

Peter,

Thank you for the example! What is the vector when derivative set to zero?

A derivation of a NurbsCurve is a NurbsCurve of lower order.

Since you evaluate for a specific t in three dimensions you get a three dimensional vector back. This vector however doesn’t have anything to do with the normal of a curve, as well as the curvature. The curvature is calculated with the first and second derivative but its not just the second derivative.
Now, I’m not a mathematician, so I’m not able to prove it to you, especially in such a short comment. I’m just knowing that it is like this, from reading books and papers about Bezier and Nurbs.

1 Like
3 Likes

@TomTom, I can’t thank you enough. I think it is getting really interesting at least to me. Could you please share any references so I can learn more about the formula? Ever since I became interested in the mathematical logic behind what I build in Rhino, I have been stumbling through books on topics like differential geometry, topology, but I feel like I am lost. Any books with lots of illustrations you could find useful on those subjects? - that would be much appreciated!!

1 Like

I’ll prepare a V1A updatte that explains all things

Oh, that is very nice of you! Thank you for your time for this.

@TomTom, I think I got the equation until it is devided by ||d1||. Very curious to know why…

But since there’s a MotoGP w/e (Brno) going on right now … in the mean time do some preparation: just read the 327 pages of this all times classic book and become a NURBS jedi master (Yoda and the likes):

3 Likes

Haha sure no worries. Enjoy The race. Thank you for the reference.

Hero Valentino starts 2nd (cross fingers).

BTW: The Rhino Method (as is also the case in other Rhino Methods [trans matrices etc]) ouputs derivative vectors differently : C2 is Rhino’s C0, C1 is C1 and C3 is C2.

2 Likes

Will do. That is great! Now the mystery solved. Of course I still need more time to digest it though. Thank you very much!

BTW: Other than Master’s book (the best NURBS thingy ever) … …and other than some basic (kinda) maths … I do hope that you speak some proper language (C, C++, C# etc).

I do own that Book as well. Its however not that easy, intuitive and straightforward as the authors want it to be. mathbooks… tztz 