Subject: Q:"linear" map to RGB for RasMol

From: Bryan Marten <[email-masked]>
Date: Tue, 29 Oct 1996 13:36:04 -0500

Dear CCLers,

What is a (simple?) function to map a linear distribution of points to a
ROYGBIV spectrum of colors expressed as RGB values?

Stated more concretely:  I have a distribution of data values which I
would like to display graphically as continuous gradations in color
where the color map ranges from red to blue/violet.  These colors must
be expressed as a set of RGB values ( 0 <= R,G,B <= 255 ).

In other words, given a data value V, what are the values of R(V), G(V),
and B(V) such that for V=-max you get "red" while for V=+max you get
"blue/violet" and in between you get something resembling a rainbow? And
a rainbow which appears to be a nice linear mapping to the human eye so
that, if possible, one has a sense that "That color is 1/3 of the way
>from red to blue so V must be about -17."

I ask because I am attempting to modify my personal X/Unix copy of
RasMol (obtained from http://www.umass.edu/microbio/rasmol) so that
RasMol will use a continuous color distribution, instead of a coarse set
of 8 colors, when it maps the molecular electrostatic potential to
colors on a dotted van der Waals surface.  Being color-theory impaired,
I do not know of a good mapping as one finds in the program Grasp, among
others.  I understand that there are as many ways to map potential to
color as there are known mathematical functions but something Grasp-like
or in some sense perceived as "proportionally spaced" to the human eye
would be great.

I'll summarize and post the finished subroutine if there is interest, if
the subroutine works, and if no one can point out licensing violations
in doing so. Thanks in advance,
-- 
				Bryan Marten
				Ciba Pharmaceuticals
				[email-masked]