Jump to content

Linear colormap


Recommended Posts

Hello,

I would like to change the color of a tank according the value of a slider.

If slider value is 0 the color should be blue.

If slider value is 100 the color should be red.

If slider value is between 0 et 100 the R G B values should be between

the RGB values of blue and red

I don't know how to do this...

I know how to set a red color to my tank using property node and color constant box

but I don't know of to make a linear colormap.

I'm also interessed in adding more colors to my colormap.

For example

0= blue

20=green

60=yellow

100= red

Thanks

Best regards

Link to comment

CITATION(jgcode @ Jun 4 2008, 02:07 PM)

Thanks guys

I ever found the sample on NI Forum

http://forums.ni.com/ni/board/message?boar...d=56852#M209743

...

but I didn't found the good keywords to get it again !

I see the sample you provide to me in the previous links

Unfortunately noone make something that could be easily be changed to fit to

any number of colours (for the ramp)

I think a good sub-vi for this should provide 3 inputs and one output

1 input for array of colors

1 input for array of stop values (same size as the previous array)

1 input for value (between 0 and 1 as float)

1 output for the resulting colour

I think a good starting point for this could be the vi of Ben.

I post it here.

Link to comment

QUOTE (scls19fr @ Jun 4 2008, 02:57 AM)

The way that came to mind for me is to use your input value as the H on the HSV scale. Scale your input value to [0,360) and http://en.wikipedia.org/wiki/HSV_color_space#Conversion_from_HSV_to_RGB' rel='nofollow' target="_blank">convert to RGB using S = 1 and V = 1. It's not real difficult, but complicated by the lack of a native HSV to RGB conversion in LabVIEW. You might also want to scale the input value starting at 240° (blue) to 0° (red) rather than from 0 to 360.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.