Grasshopper

generative modeling for Rhino

# Subdividing an interval for color gradient

I have a list of 3250 values ranging from 87.7 to 90.8 from calculating angles between vectors. I would like to take this interval and split it into 3 parts:
1. 87.7 to 89.99
2. 89.99 to 90.01
3. 90.01 to 90.8
I then want to apply color gradients to the first and third intervals and a single color to the middle interval.

I tried doing it by manipulating the positions of the grips in a gradient component but since they can only be set by percentage, I am unhappy with their accuracy.

Is there another way to achieve what I am trying to do? I was wondering if it would help to use three gradient components, one for each interval. But I cannot find a way to split the interval based on values...

Thank you all!

Views: 129

Attachments:

### Replies to This Discussion

Hi Sameer,

I would recommend using an ARGB component to create your color from r,g,b chanels (a number between 0-1).

First you can divide your values into the three interval groups. Then you can determine where within the group they are (as a percentage 0 - 1) this can then give you the input value for your r,g,b.

Hope this helps.
Not sure if this is what you are looking for, but you could modify the list of values so that all the values between 89.99 and 90.01 equal 89.99. Then for values higher than 90.01 subtract the difference so that the highest value of the interval becomes 89.99 + (90.8-90.01). Now you can create the color gradient with this new shorter interval without worring about percentages.

by Alex

by Alex

by Alex

• View All