algorithmic modeling for Rhino
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
Tags:
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.
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:
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by