Grasshopper

algorithmic modeling for Rhino


Hi everybody, I'm working on a definition that scales curves, based on how close a point is, so I used a typical distance and minimum components, then i used a cosine component with an expression multiplying it by pi/2, so it reverses the values so when the value is cero i get the maximum size, and with 1 I get zero scale.

the problem is that now I want the same thing but I want to scale the curves from 0 to .5, so in a cosine definition the values would have to go from pi/3 to pi/2

So my problem basically is how do I imput my distance values to a component and i make it range between those values. it seems a bit confusing but i don't know what other function to use or multiply it by something else


thanks in advance for your help
cheers
Diego

Views: 1126

Replies to This Discussion

This is a frequent task within Grasshopper — I hope at some point a component will be introduced to take care of it in one go. I have seen people create them with scripting, but I always do it the manual way. I usually use a custom expression to take care of it, as seen in the attached ghx, but I have decomposed the expression into its respective components in the image, to show what's going on. The expression I use is this:
((values-currentMin)/(currentMax-currentMin))*(desiredMax-desiredMin)+desiredMin
As far as I know the max and min of a set of values cannot be calculated inside an expression component, so you have to use "Bounds" and "interval components" to get those values.

Hope this helps!
Attachments:
This is great helps a lot, I had settle down for a linear equation giving me similar results, but this actually gives me better results, thanks a lot I really like the expression, i knew it was a kind of equation in which i had to divide and multiply but my math is kind of rusted these days.I agrre with the component idea, it would have a great idea to tell david about two weeks ago....


thanks a lot again, this has been very helpful, especially now that the next part of my definition is to scale from 0 to .25 so i'll use this solution a lot from now on, I agrre with the component idea, it would have a great idea to tell david about two weeks ago....

Diego

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service