# Interpolate curve tangent

Hello, Question about creating a rocker curve in Grasshopper
The way I do right now is through simple component intcrv with vertices representing P1, P2, P3, P4.
What I want is to have control on adding a more steep curve between P1 and P2 and also between P3 and P4 but keeping the curve with a nice continuous curvature P2 and P3. My guess is that it might be possible with Intcrv(t) but I cant manage to work it out.

Use Nurbs Curve instead of Interpolate Curve and move P2 closer to P1 (and move P3 closer to P4). You can also add a point in the middle between P2 and P3.

Thanks for your reply Joseph, I like the smooth curvature it creates but the problem is that it deviates a lot from the control points, is there a way of creating something similar but sticking to the points location?
In my view it would include changing the curvature with different tangents in the specifics segments of the curve ( P1-P2) and (P3-P4).

rocker curve.gh (11.3 KB)

I find it very difficult to read code that is so spread out, as yours is. P2, P3 and the midpoint should all have the same Z value. Had you posted your code when you started this thread, I might have a go at re-writing it butâ€¦ meh. Something like this:

rocker_2021Dec26a.gh (11.7 KB)

If that doesnâ€™t give enough control, you might need to add another pair of points.

rocker_2021Dec26a2.gh (13.7 KB)

Maybe this video of a â€śdeadrise widgetâ€ť I wrote six years ago will give you some ideas.

Thank you so much Joseph, I watched the deadrise widget video on another topic, with another video of hull design with 2 curves, great stuff. Also thanks for your code, thatâ€™s basically what I wanted, I added a few extra controls as I want it not to be symmetrical and also more control on the z axis for the P2 and P3
rocker_2021Dec26a3.gh (18.6 KB)

You mean the two endpoints, labeled P1 and P4 in your drawing? Oh, maybe not. I would advise against modifying the Z value for intermediate points as it can adversely affect the smooth shape (tangency) of the NURBS curve.

Not that it matters to me but it is customary to mark the post that provides the solution.

Sorry, I forgot to mark the solution, done.
It seems to be working well with 3 points on Z 0 and the others Z moveable, I also changed the domain for the Z of P2 and P3 to be less then half of value of Z in P1 and P4. But I get what you mean, the curve looks smoother when the points are not too close together.
rocker_2021Dec26a4.gh (16.0 KB)

I should have used the word â€śfairâ€ť instead of â€śsmoothâ€ť. A CrvGraph (Curvature Graph) shows the issue better:

In my experience, keeping an eye on curvature graphs will avoid unwanted deviations, hollows and flat spots in the resulting surfaces.

P.S. This is applicable to all NURBS curves, not just SubD:

1 Like

I see what you mean, I am playing with curvature graph now. I might have to go back to the interpolate crv, it gives a fair curve and not much of flat spots. The nurbs crv with z set to 0 gives a lot of flat parts or not much curvature. Any ideia why the graph on the intcrv is made more of straighter lines?
Thanks a lot for your inputs Joseph