Grasshopper

algorithmic modeling for Rhino

Hello,

I have an analysis mesh from a wind simulation (see attached). The mesh colors range from blue (-7p) through white (-1p) to red (5p).

I would like to remap the coloring between -7 to 7, so that the zero pressure Areas of the mesh are shown in white.

I'm drawing a blank here, how do I do this?

Cheers,

Max

Views: 2623

Attachments:

Replies to This Discussion

Hi Max, this function demonstrates both how to map a list of values from domain to another and how to make a color gradient based on this. Might help: https://gist.github.com/AndersDeleuran/82fa2a8a69ec10ac68176e1b848f...

Hey Anders, that's definitely a start, thanks. In my case, I don't have the original values, only the colors. I need to somehow reverse engineer the values before I can even use your function, right? Maybe all the info is there already and I'm missing it, I'll check it out when I get back to my computer.

Yes, you would need to know how the values are mapped onto a color gradient in the model which generated the colors in the first place (i.e. which channels in which color model in which range). You might be able to guesstimate this through a bit of trial and error if you do not have this information. Looks like it's operating within the 0.0.-0.7 Hue channel with values in the middle having lower Saturation and higher Lightness (assuming it's using a HSL model). Sorry to not be of more help ;)

In ParaView the gradient is specified with 3 nodes whose values can be specified as either rgb or hsv.

I am able to set the domain of the gradient manually, which in this case solves my problem easily, but I didn't have access to the program over the weekend and was curious how to do this in GH alone.

I haven't had to deal with color models at all so far and probably should :) Thanks for your help!

Cheers,

Max

You can use a trick to get colors as numbers/values for a new gradient:

Draw your colors as points and create a curve, so you can evaluate those points on the curve and gets the parameter (t) as a list of values... then you can remap and create a new gradient.

edit: i tested to see if this work... i didnt bother to correct remap the red color from "-1p to 5p" to "0p to 7p" (i just move the gradient in "one" step). Also the original gradient its not linear (second imagen: original red points vs new gradient green points).

edit2: Also i use a reduced mesh (original mesh was too dense for my pc).

Attachments:

Ha, that's pretty creative :) I have had some bad experiences relying on curve parameters in the past, since these don't always correlate with the length of the curve. Your method probably distorts the result slightly but is obviously useful for a qualitative analysis. Thanks!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service