Grasshopper Beginner


(Ericryan Suarez751) #1

Good day! I am new to grasshopper and I don’t have any idea what Interpolate Curve does. Any help will do.


(Michael Pryor) #2

http://docs.mcneel.com/rhino/5/help/en-us/commands/interpcrv.htm
Same info applies


(Aris Nikolopoulos) #3

If I can help to make it simpler (I have been struggling with the concepts myself):
It is a curve where you define points that the curve will pass through.
so, do not expect that by moving the points you defined the curve will update. Once you have created it, they go away and you are left with the control points.


(Michael Pryor) #4

You can edit them with the Rhino command EditPtOn only difference is there will be two extra points one near each end point to hold the tangents. In grasshopper you can edit them after the fact by moving them in grasshopper or rhino (depending how you made them) before the interpolated curves creation (the parametric benefit of gh)


(Aris Nikolopoulos) #5

I didn’t know that!!!
(I feel ashamed and grateful) hehehe


(Aris Nikolopoulos) #6

just out of curiosity (and at the risk of derailing the conversation):
how do you manipulate/reference those points within grasshopper?
(correction: It’s obvious that you manipulate them by defining the curve in the first case-obviously- but is there a way to find such points in an existing curve?)


(Tom) #7

these points are called greville points. You can retrieve them by script…

NurbsCurve nc = crv.ToNurbsCurve();
Point3d gp = nc.GrevillePoint(index);

however, retrieving a new cphull from Greville points is possible but not simple.
I have two algorithms for this, but I don’t like to share them… Its basically, de Boor or de Casteljau in Reverse…


(Aris Nikolopoulos) #8

fair enough!
I’m counting the times scripting is the answer to a problem. The 100th I’m going to start scripting :joy:


(Michael Pryor) #9

Yes here is a c# component for it. Then if you remove the extra edit points you can get basically the same curve back if you make sure to use the same knot spacing and degree as the original you made. (you will see in the file the original curve and new curve overlap exactly - removing always the second and second to last point)


EditPts.gh (9.9 KB)


(Aris Nikolopoulos) #10

You seem to be more sharing, thanks!
Share the wealth of knowledge! it’s the only kind of wealth that increases by sharing!!!


(Michael Pryor) #11

Well this is simple. As @TomTom says, lot of cases are not so simple (try making a curve with sharper turns it will be very hard to make the same curve again with the edit points)


(Tom) #12

I have shared you exactly the same as he did…


(Aris Nikolopoulos) #13

Tom, don’t get me wrong. I didn’t mean it as a judgment towards you. I tend to get philosophical. please don’t misunderstand me :slight_smile: especially when you have already helped me quite a few times.


(Michael Pryor) #14

Actually, If your curve is drawn initially as an interpolated curve this method will get it each time. The issue is when using it on a curve that was drawn as say a control point curve or as Gh calls Nurbs curve. Draw in rhino 2 curves one with control point curve and one with interp curve. Use them both in that definition and you will see the difference. But there are many cases.


(Tom) #15

I do understand this mentality very well.

However implementing an own interpolation algorithm is much more demanding. And Rhino interpolation is not the only one you can choose. They can and do differ strongly. Creating such algorithm is much more work, since you do the math by yourself (which is higher university level) . I also compete with other companies in my daily work, so sharing them could be a disadvantage for me and my company. Besides that it took me weeks to find out. So its always a balance about what to share and what not to share.


(Aris Nikolopoulos) #16

Accept my apology, I understand what you say


(Michael Pryor) #17

Didn’t see your post as I had the comment box opened already with browser at a small size so it covered all responses as I made the file to post (was six minutes later :smiley: ) Anyway now at least he can see the by index way you did or the get all to Point3dList way. Guess that’s worth something.


(Tom) #18

This is to due to the parameterisation of the curve. In order to reverse de Boor, you need to define the (parameter) spacing between each Greville point. On a curve drawn by controlpoints, you need to store the spacing and apply it to the equation. However the rhinocommon interpolation only provides “presets” of the spacing only, by assuming its equally spaced, chordal etc…
You actually need an interpolation algorithm where you can explicitly define the spacing, by measuring it from the initial curve.


(Michael Pryor) #19

Yes I understand this. I am just explaining briefly and generally on what case it does / does not work (to a degree) in Rhino curves to @anikolo


(Tom) #20

…whats actually far more interesting is a functionality which approximates : you have more “editpoints” as controlpoints, and you want to find a solution which fits best. I haven’t found a good algorithm yet, although I know that Alias and Surf does have very good ones.
Rhinos FitCrv is not very useful, since you have no control about controlpoint count etc.
I tried: least square (+ recursion), interpolation + rebuild, recursion only. But none of them came close as those from the cad software mentioned above. An additional smoothing algorithm would be good as well