The world of RGB colors
An RGB color has three components: red, green and blue. On a computer each
of these components is usually represented by a 4 digit hex integer.
If to each point (x, y, z) of the unit cube we assign the color
([65537*x], [65537*y],[65537*z])
we come to the idea of the RGB cube
in which every object, point, line, plane and arbitrary surface is colored.
The following programs are designed to give answer to some simple questions.
 rgb_segment
We can see the color of any segment A'(x1,y1,z1), B'(x2,y2,z2)
by mapping it to the segment[t1,t2] using linear functions. If, in
Mathematica's notation, M is the matrix {{x1, x2}, {y1, y2}, {z1, z2}}
and V the vector {{A[t]}, {B[t]}, where A[t}, B[t] are linear functions
such that A(t1)=1, A(t2) = 0 and B(t1) = 0, B(t2) = 1, then the matrix product
M.V = {{x1 A[t] + x2 B[t]}, {y1 A[t] + y2 B[t]}, {z1 A[t] + z2 B[t]}}
is the required transformation. At t1 and t2 we have colors (x1,y1,z1),
(x2,y2,z2) and to each point of [t1,t2] we assign the color defined by the
matrix M.V.
This is done in the program rgb_segment. In this program arbitrary colors
can be entered at A' and B' and the program produces the colors of A'B'
on the segment [A,B] extended to a strip
 mini_rgb_segment
is a simplified version of the rgb_segment program

rgb_cube_faces. This program shows the colors of the 6 faces of the RGB cube
using the facts that 8 basic colors (black,red,green,yellow,blue,cyan,
magenta and white) are the colors of the vertices of the RGB cube.
The color of the face is determined by techniques used in the RGB segment
program. Let us denote by A, B, C, D the vertices of one of the faces. The
program first finds the colors of the (vertical) segments AD and BC. Then
it draws (horizontal) lines parallel to AB using the fact that the colors
at segments AD and BC equidistant from AB are already known.
This is the image of the RGB Cube's face perpendicular to the blue axis
This is a 3D image of the RGB Cube. It was obtained by using the rgb_cube_faces program to obtain the 3 faces of the cube with one red vertex and the Adobe Illustrator to transform two faces.(Download this picture)
 rgb_triangle, .Any set
of three distinct points A', B', C' inside the RGB cube determine a triangle. To determine the color of each point of the triangle
using the colors of A', B', C' we can use again linear interpolation.
Let M be the matrix {{x1,yx2,x3},{y1,y2,y3},{z1,z2,z3}} where the columns are
the colors of the vertices A',B',C' and let V be the vector
{{A[u,v]},{B[u,v]},{C[u,v]}} where A[u,v], B[u,v], C[u,v] are linear functions
(planes) satisfying conditions
A(u1,v1) = 1, A(u2,v2) = 0, C(u3,v3) =0
A(u1,v1) = 0, B(u2,v2) = 1, C(u3,v3) =0
A(u1,v1) = 0, B(u2,v2) = 0, C(u3,v3) =1
The matrix product M.V maps then the triangle A'B'C' into a triangle
ABC with vertices (u1,v1), (u2,v2), (u3,v3) and each point of the triangle
ABC is colored with the rgb color determined by the product M.V
mini_rgb_triangle is a simplified version of the rgb_triangle program,
similar to the program GouraudMod posted by R. Purves on the FB list.
 mini_rgb_triangle
is a simplified version of the rgb_triangle program
For smooth transition of colors, all these programs should be run on a
monitor capable of showing millions of colors. Drawing of a point is done
by the function SetCPixel and the reading of the color of a point is
done by the GetCPixel function.
The meaning of color interpolation becomes less clear if we have more than
three non coplanar points in the RGB cube.