|
With help from Dennis Bouvier, I've fixed the
problem.
I was mapping values linearly to a subset of HSVA
dimensions -- because of re-use of a color mapper for previous problem -- but
that's not a linear mapping in RGBA space. For example, the graph of values
mapped to hues was an arc of a circle in HSVA space, and there was no reason to
expect an arc in HSVA to be a line in RGBA.
The solution was simply to linearly interpolate between
two points in RGBA space.
Given the geometric
primitive below (best viewed with monowidth font):
+ (x0,y0,z0)
|\
|
\
| \
(x3,y3,z1)+ +
(x1,y1,z1)
| /
|
/
|/
+
(x2,y2,z2)
Let z0 > z1 > z2.
With Gouraud shading, what is the color at point (x3,y3,z1), as a
function of the colors at (x0,y0,z0) and (x2,y2,z2)?
Is the calculation specific
to color representation (e.g., RGB or HSV)?
Why I'm
asking:
I'm developing a surface graph that displays a value as both height and a
color, both using a linear mapping. The color mapping linearly maps to some
subset of HSVA. (A maximum of 179 degrees of hue are used.)
For example, the value
might be mapped to both height and hue. But the color at (x3,y3,z1) is
usually lighter than that at (x1,y1,z1).
"Pa-pa" -- Zachary Thomas-Cramer, age 11-1/2
months. ================================================================================
|