Grasshopper

algorithmic modeling for Rhino

I presume that this is a math issue. How do i scale an interval?

Is it possible to change an interval, that goes from A to B, into an interval that goes from C to D but retaining all of the values in between with the same ratio?

Views: 1581

Replies to This Discussion

Maybe subtract the smallest value in the list from all of the numbers, and then dividing by the largest?
look for map range function
Hi Dusan

just cleaned a custom map function I had
i hope it works for you

I guess this kind of function will be a built-in node in GH very soon
Attachments:
Check this thread I asked once what I think is the exact same issue
http://www.grasshopper3d.com/forum/topics/values-in-a-desired-interval

Diego
i wondered there should be already a thread and a solution on that.
Andrew Heumann solution , proposed by diego is straight, quicker.
Thanks for the answers. As i pretty much immediately answered myself for the manual way, i did the one using math (is it called arithmetics?) to scale the interval into the 0-1 domain. I was wondering if this was the correct way to do it, the script looks nice but i know nothing about Vb so i don't understand it :(
Now could you take a look at a simple definition that i have?


I am trying very hard to create an atractor that has a falloff. The one from the primer acts in a very weird manner. I first tried to do a single attractor with a dispatch with larger than instead of minimum. So for example, i could set the radius of the circles outside of attractors influence, and inside, they would gradually get scaled the closer they get to the attractor. Dispatching them, is very cumbersome and i couldn't figure out a way to combine multiple attractors.


Here im trying to move the points, within the attractor influence. The 0-1 domain works fine, and is just what i want, the problem is the minimum component. It find's the lesser of two numbers but i want that number to turn into 0, rather than have the value of my attractor's influence. I tried to solve this by simply subtracting this influence value from the distance list (in this case the number is set to one because im working in this domain, otherwise i guess you could link the slider into the B slot of the minus component).

This works like a charm when there is something for the attractor to influence. The problem appears when i move the attractor point away from the point grid, and when it doesn't catch any of the points, OR when i set the influence to 0.

What happens is, the influence number is then smaller than all of the distance values, and my distance list turns into an interval from X to X, meaning they're all the same number. When the "scale interval" math kicks in, the all turn into zeroes. And then when my minus influence thing kicks in, they turn into values, and my whole grid moves.

Just place a point somewhere, and youll figure out the definition.
Attachments:

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