Example 11. Pseudocolored Stereo-Pair of a 3-D Lissajous Function

The human eyes are easily tricked into seeing 3-D structure in a pair of flat images.  The trick is to make one of the eyes think it is seeing around a corner.  That can be accomplished by 'squashing' one of the figures along the axis between them with a separation distance close to the intraocular distance between the eyes, ca. six to seven cm.  Image 11.1 below uses a circle on the left and a squashed circle (ellipse) on the right - produced with a simple drawing program such as Power Point.  In the top pair, both objects are circles and no stereo effect is seen.  In the bottom pair, the circle and the ellipse can be made to overlap by relaxing the eyes or by using a stereo view directly on the computer screen or on a printed copy.  Notice that the right-to-left shift of pixels in the ellipse makes the combined picture 'pop-out' of the screen.  The 3-D object appears as if its right side is out and its left side is in the page or plane of the computer screen. 

A six degree rotation of one object relative to the other is sometimes quoted as being the optimum for stereoscopic human vision.  This is based on the separation between the eyes and and the physics of parallax.  In graphics, one can use a more exaggerated angle to produce a more obvious 3-D depth.  Relax your eyes and stare at this for a while.  Some people see three images, the two originals plus the middle, 3-D image formed by perception.  Other people require a stereo viewer. With some training of the eye, the process becomes easier with experience in viewing such figures.

 

   

Image 11.1  Stereo pair.  The lower pair of figures should fuse into a single 3-D object with the right side protruding out of the screen.

 

Mathematica has a built-in function called 'ParametricPlot3D'.  Such a plot is shown below for a Lissajous function that is within a reference cube with sides of equal length.  In this Lissajous plot, the x, y, and z axis are all dependent of a single independent variable 'angle', in degrees, that is used by three different sin and cosine functions:

{R, G, B}= {x, y, z}={(Sin[2*Pi*angle/360] + 1)*50, (Sin[2*Pi*2*angle/360] + 1)*50, (Cos[2*Pi*angle/360] + 1)*50}

Lissajous figures seen in three dimensions were marveled at 50 years ago when engineers placed out-of-phase waves on the horizontal and vertical inputs of analog oscilloscopes.  With variations in sync and phasing, the figures dance and rotate in a somewhat hypnotic manner.  The examples, below, are static, but the underlying computer code could be further exploited to produce phase differences and rotation in a series of animated gifs.

 

       

Image 11.2  A Lissajous function in a cube viewed from above.  The x axis is directed down, the y axis points to the right, and the z axis points up.  These axes are labeled red, green, and blue, respectively, so that comparisons can be made with the same function drawn in stereo pairs, below.  The origin is the upper-right-back corner of the cube (black, K).  The lower-left-front corner of the cube is white (K).

 

Image 11.3 is redrawn as Image 11.4 below with approximately the same perspective.  Green is to the right, red increases as one moves down, and blue will be projected out of the page by the manipulations given below that involve right-to-left shifts along the y axis (green) proportional to the value of blue.

       

Image 11.3  The Lissajous function of 11.2 drawn with the coding of a Schroedinger cube (x, red; y, green; z, blue) so that position and color are encoding the same information.  If you know the color, you have the position in 3-D space. 

In Image 11.4, below, we have spaced two images - identical to 11.3 - at the intraocular distance as a control for the stereo pair that follows.  This is very confusing to the eye, either with or without a stereo viewer.  The 3-D effect should not be observed in this pair.

Image 11.4  A control of two identical Lissajous figures.

In the final Image, 11.5, we shift pixels along the y axis proportional to the value of the z axis given by this Lissajous function.  Another way of thinking of this shift is in color: pixels are shifted (in space) to lower values of their y (green) coordinate, but the same RGB values are used.  That spatial shift is proportional to the blue value which is in the axis perpendicular to the page.  The x-axis, perpendicular to the intraocular axis, remains unchanged as it did in the simpler example of Image 11.1.

Image 11.5  Stereo pair of a Lissajous figure.  Relaxing the eyes or using a stereo viewer will show the blue-white junction as projecting out of the page over the top of the red-green transition.

Further insight into this example can be found in the comments of the source code, here in notebook form and also in PDF .

1