Control points' math relation of G2 continuity

Hi guys,
Just share some information. I studied control points’ math relation of G2 continuity and find out the following function relation.

a=d1/d2, b=h1/h2,
when the two curves’ relation is G2, and all the control points’ weight is 1.0,

Maybe we barely use G2 relation in grasshopper, but I think it will do some use under some circumstances.

Well, it only works when the two curves are in the same degree.


I’m not sure if this correct for any case. I solved it by ratio equation when moving in h1 direction. In the following thread I posted a component:

1 Like

There is also a goal for this in Kangaroo- (16.2 KB) g2gif
Can be handy if you want 2 separate curves to meet G2, yet control an interpolating point where they meet. It’s on my long term to-do list to improve the interface for this, and maybe extend to other conditions for degree/weights/knot-vector.


I just want to point out that my component works for any parameter not just the endpoints :smirk:


Not sure I follow - in the above also any of the control points of either curve (not just end points) can be can be set as either driver or driven

Actually, a few days ago I searched in this forum and found your component :rofl:. It’s really awsome.
But I can’t see the component’s logic and I really want to know it, so I studied just for interest and found the basic function. If someone wants to use it, they can make their own logic according to their need.

Since I’m only evaluating the tangent and curvature at a parameter, I can match at any point of a curve. It is not directly based on the controlpoints.
Furthermore the main difference between both components is, that my reference curve is not changing its cvs for matching. It just matches a to b at any given point, but doesn’t change b actually.


Anyway to match two curves with g2 you just move the third cv in h2 direction for a length of 0.001. Before and after you do this you measure the curvature at t. then get the delta curvature. You just need to find the length of the vector which is required to get the length of the reference curvature. After you matched the curvature you can move p2 (third cv) in tangent direction. This does not destroy the g2. This is what is refered as “factor” in my component. Maybe I push it on git…

Yes, rencently I am learning Kangaroo 2 and saw this G2 goal. It is very handy. I study the function just for interest. I never thought I can figure out it as a math freshman :stuck_out_tongue_closed_eyes:

That’s really great for not directly based on the controlpoints. Maybe I can make a cluster according to your logic with grasshopper (because I don’t know how to make a component with programming. :sweat_smile:

Ah I see now, you are only adjusting one curve to match at a given parameter of a fixed input curve.

Depending on the application, I think both parametric (1-directional dependency) and variational (multi-directional) can be useful. If you want to be able connect things in loops then an iterative method is essential.

(I also really like the tools XirusCAD has for this)

1 Like

Three plus decades ago I developed algorithms for similar questions involving B-splines and wrote Fortran code to implement the algorithms. Using control points and the NURBS formulation the problem of matching G2 matching of a degree 2 or higher at a selected location/parameter value to a selected point on another curve can be set up as a linear set of equations which can be solved directly for non-rational, ie all weights equal to 1 curves. Is there interest in details?


I’m really interested in the details, but also afraid that I’m not be able to understand it. :joy:

1 Like

Here I pushed it on git, if somebody is interessed in the source code:


Great work. Is there a way to extract the curvature graph, as a curve for further tinkering, in grasshopper? The “CurvatureGraph” component does not have an output

You can generate your own like this (white group): (10.9 KB)

1 Like

That works, thank you Joe.