generative modeling for Rhino
Can anyone tell me how, or if it is possible fundamentally to have:
2 sliders that are inserted into a function, and as one slider is changed the other slider is affected, for example as the fist slider is increased, the second decreases according to the function?
But it seems odd you would want to use a slider for this. If you want to link a second value to a slider, just do the math without a second slider. Basically my question is; why do you want two sliders to change a single value?
Ok, what would the user interface for this look like?
I suppose you'll want to enter an expression somewhere? Does this expression need access to other Grasshopper data or does it contain only constants? Do you want to use Grasshopper components to define the relation between these two sliders? Is it only ever two sliders, or should it be possible to hook any amount of sliders together?
More than two sliders seems tricky. (If you change one, which one of the others should change?)
You would somehow have to "lock" the relation between two sliders with a function. But possibly also set a master/slave relation in order to determine which slider should change to match the function at the start.
I realize some of the difficulties with this whole idea and I wonder if it's really worth the trouble...
So if you change slider A to be 4, then that would mean that slider B should be set to 12/(2*4) = 1.5 right? Except it can't because it's an integer slider. And what happens when the value is outside of the slider domain?
You'll need to define two expressions, one that tells me how slider B should change when slider A is dragged around and vice versa. One equation is not enough (even beyond the difficulties of solving it both ways, you'd basically need a very advanced mathematical algorithm). Take for example:
Sin(x) = y
It's easy to determine the value of y for any given x, but for a lot of y's there is no answer for x. And when the expression is solvable there are an infinite number of x's that could be valid. You'll run into similar problems with parabolas, hyperbolas, higher order polynomials, you name it.
I would better like a Numeric Slider that has an input like the Loft, or like the Rebuild Curve or like the Mesh Settings, where you can set all the parameters that compose the slider, like the Min and Max limits.
It will help us a lot, think.
Thanks a lot Danny. That helps a lot too. It is close to what I want :-)
I may change yours to go from 0 to 100 and then divide it by 100!