This example effectively tests the RGB (Red Green Blue) and the CMY (Cyan Magenta Yellow) color definitions. The squares are colored according to their position: Each square has an x, y and z coordinate in the color volume. These coordinates are translated into the intensity of the red, green and blue color component for one face of each square and into the cyan, magenta and yellow component for the other face. |
The discs are colored with the HSB (Hue Saturation Brightness) color definition. The position angle of a disc determines the hue, the distance from the axis the saturation and the height the brightness of its color. The diameter of each disc changes with its distance to the viewer. This is one of the differences between the ways LiveGraphics3D and Mathematica paint graphics. |
Here is how to create these graphics within Mathematica:
g=Show[Graphics3D[{ EdgeForm[],Table[{ FaceForm[RGBColor[x,y,z],CMYKColor[x,y,z,0]], Polygon[{{x,y,z},{x+0.2,y,z},{x+0.2,y+0.2,z}, {x,y+0.2,z}}] },{x,1,0,-1/3},{y,1,0.,-1/3},{z,1,0.,-1/3}] },Lighting->False,Background->GrayLevel[0]]]
This will show the topmost picture within Mathematica. The following command is used to produce an appropriate InputForm of g:
NumberForm[InputForm[N[g]],4]
Mathematica's output was then copied into a file called color_cube.m. This file is specified in the HTML code of this page (applet parameter INPUT_FILE) and, therefore, loaded and displayed by the LiveGraphics3D applet. (See the documentation for a complete description of the usage of LiveGraphics3D and a function to let Mathematica write the InputForm directly into a file.)
The second Graphics3D object was produced this way:
g=Show[Graphics3D[{ PointSize[0.1],Table[{ Hue[h,s,b],Point[{Cos[h 2. Pi] (s+0.2), Sin[h 2. Pi](s+0.2),1.5b}] },{s,0.32,1,1/3},{b,0.24,1,1/4},{h,0,0.99,1/12}] },Background->GrayLevel[0],ViewPoint->{0.8,1.2,1.2}, PlotRange->{{-1.2,1.2},{-1.2,1.2},{-0.2,1.7}}]]
And the same command to generate the InputForm as above.