Grasshopper

algorithmic modeling for Rhino

Interpolate data component does not keep the original numbers?

hi guys, I have a question about interpolate data component.I am trying to interpolate 20 points in between a set of data.

(let say, the original data to interpolate = 0 , 5 , 10 , 15 , 20)

and I want to interpolate them to fit into a 20 list length of data

(Normalized Interpolation Parameter = 20 number ranges from 0.0 to 1.0)

I was hoping to get a result like =

0 ,X,X,X 5, X,X,X,X, 10 X,X,X,X 15, X,X,X,X 20

(whereas X is the number in between my sampling data)

after I plug it to interpolate component, the original data is lost. the output data is somewhat a modifed number from the original ( I think because the component tries to even out the distance between numbers)

however, I still need to keep the original number

I have attached an image and GH definition to let you have a look. is there a way to fix this? (maybe somehow we can "lock" the input data, or maybe I am doing it wrong?)

thank you

Views: 2522

Attachments:

Replies to This Discussion

I don't think it is possible in the component as it exists. Possibly a Wish for David.

In the mean time here is a work around.

Attachments:

hi Danny, thanks for the quick reply :) ah I guess you are right, maybe interpolate component should add a true/false button to either lock or unlock the input. appreciate for your time mate, I will use your definition to complete mine :))

thank you :) you saved me from a lot of work

Get this "compact" solution as well: (BTW: This kind of stuff is very easy with code).

The C# attached works "like" your screenshot: branches with values 0, rand1, rand2, 1 belong to an "initial" tree. Then a new one is created with N interpolated (random) values - obviously keeping the rand1,rand2 pair intact. 

Attachments:

It is working exactly as it's supposed to be working. The reason you're not getting your intermediate values out again is because you don't sample at those locations:

The red curve is the original data, the cyan curve is the sampled data.

Since your original data contains 3 segments, any sampling count that is a multiple of 3 will give you the exact positions:

Even here though there will be rounding artefacts, but these are probably only visible in the least significant digits, well beyond the 6 digits normally displayed in text panels.

In fact it doesn't matter what interpolation algorithm you use, as long as the sampling happens at multiples of 3, you'll get the exact same values out again:

@Peter = I guess I need to start learning about programming as it can be quiet handy to really get all benefits from grasshopper. thanks for the awesome code. you da man!

@David = Thanks for clearing up my confusion, I follow your suggestion and it works perfectly ! :) good thing I like about this forum is that we always get quick responses, even from the grasshopper creator :)))

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service