		      PRETUTORIAL FOR MINNEVIEW

	      as told to Fred Almgren by Tamara Munzner

==========================================================================

A SAMPLE FILE FOR MINNEVIEW.

The following is a file in one of the MinneView formats.  The name of
the file is
		csquare.quad

The ``.quad'' at the end has to be there because it is a ``quad'' type
file.

--------------------------------------------------------------------------

    CQUAD
    -1 -1 0   1 0 0 1
     1 -1 0   0 1 0 1
     1  1 0   0 1 0 1
    -1  1 0   1 0 0 1

--------------------------------------------------------------------------

The first line tells MinneView what kind of file it is; in this case
it is a CQUAD or color quadrilateral type file (which is describing a
square).  The next four lines correspond to the four vertices of our
square (each polygon in a CQUAD file has four declared vertices--if
the figure is a triangle just make the last two vertices the same).

The first three numbers (-1 -1 0) on the first line are the x, y, and
z coordinates of the first vertex.  The next three numbers (1 0 0) on
the first line are the rgb colors assigned to that vertex.  Each of
these numbers is between 0 (off) and 1 (full on); the color here is
red.  The final number (1) of the seven is the degree of transparency.
This is also a number between 0 (fully transparent) and 1 (opaque).
The vertices are in counterclockwise order so that the normals are
computed properly.

The present file represents a square having z coordinate equal to 0.
The following file contains a second square having z coordinate equal
to 1.

--------------------------------------------------------------------------

    CQUAD
    -1 -1 0   1 0 0 1
     1 -1 0   0 1 0 1
     1  1 0   0 1 0 1
    -1  1 0   1 0 0 1
    -1 -1 1   1 0 0 1
     1 -1 1   0 1 0 1
     1  1 1   0 1 0 1
    -1  1 1   1 0 0 1

--------------------------------------------------------------------------

Since everything comes in multiples of four it is clear to MinneView
where the second set of four vertices begins.


==========================================================================

HOW TO GET MINNEVIEW TO DRAW THE SQUARE

There are two ways which work.  The simplest is to type

    MinneView csquare.quad &

The reason for the "&" is to run MinneView in the background to save
having to open another window.  A second way to have MinneView draw
the square is to type

    MinneView -M it &
    stuff it csquare.quad

The word ``it'' used two times in the second example is an arbitrary
name chosen by you which can be replaced by something else.  The word
"stuff" is the name of a program which cannot be changed.  If you type

    MinneView -M it
    stuff it csquare.quad ctriangle.quad

then both a square and a triangle would appear in the MinneView window
(assuming you had a triangle file called "ctriangle.quad".)  This works
for more figures as well at the same time.



==========================================================================

HOW TO GET MINNEVIEW TO PRINT OUT A PICTURE OF THE SQUARE IN ITS WINDOW.

With the cursor in the MinneView window, push down the right mouse
button.  A menu should appear.  Select the submenu under "Save".  In that
submenu, select the bottom item called "IrisFrame".  It produces a file
in SGI image format called "MV0000.sgi"; if this is the 6th picture you've
saved MinneView automatically calls it "MV0005.sgi". To print it, type

    tops MV0005.sgi | lpr

This should produce a PostScript output at the printer.


==========================================================================

HOW TO CREATE SQUARES WHICH MOVE UP AND DOWN IN THE Z DIRECTION.

The idea is to make a C program which sequentially pipes CQUAD files
to MinneView.  The following program called

    updown.c

will do the job.  The shared memory object is called "itt".

--------------------------------------------------------------------------

    #include <stdio.h>
    #include <math.h>

    main()
    {
    int i, N=1000;
    double t=0.0, dt= 0.1;
    FILE *f;

    f = popen("stuff itt", "w");

    for(i=1 ; i < N ; i++)
    {
	fprintf(f, "CQUAD\n");
	fprintf(f, "%g %g %g %g %g %g %g \n",
		-1.0, -1.0,  sin(t), 1.0, 0.0, 0.0, 1.0);
	fprintf(f, "%g %g %g %g %g %g %g \n",
		 1.0, -1.0,  sin(t), 0.0, 1.0, 0.0, 1.0);
	fprintf(f, "%g %g %g %g %g %g %g \n",
		 1.0,  1.0,  sin(t), 0.0, 1.0, 0.0, 1.0);
	fprintf(f, "%g %g %g %g %g %g %g \n",
		-1.0,  1.0,  sin(t), 1.0, 0.0, 0.0, 1.0);
	fprintf(f, "%g %g %g %g %g %g %g \n",
		-1.0, -1.0, -sin(t), 0.0, 1.0, 0.0, 1.0);
	fprintf(f, "%g %g %g %g %g %g %g \n",
		 1.0, -1.0, -sin(t), 0.0, 0.0, 1.0, 1.0);
	fprintf(f, "%g %g %g %g %g %g %g \n",
		 1.0,  1.0, -sin(t), 0.0, 0.0, 1.0, 1.0);
	fprintf(f, "%g %g %g %g %g %g %g \n",
		-1.0,  1.0, -sin(t), 0.0, 1.0, 0.0, 1.0);
	 
	fprintf(f, ";");
	fflush(f);

        t += dt;

	sleep(1);
    }

    pclose(f);
    exit(0);
  }
}

--------------------------------------------------------------------------

This program should be compiled using the Makefile

--------------------------------------------------------------------------

    updown: updown.o
	    $(CC) -o updown  updown.o -lm

--------------------------------------------------------------------------

The sequence of commands is then

    make
    MinneView -M itt &
    updown

The image of two squares moving together and apart should appear on
the screen (at least after you have rotated the image to see what is
happening as described below).  If the C program above were modified
to generate only a single square with changing z coordinate, then
nothing would seem to be happening in the MinneView image because the
picture is always automatically centered (but see below).


==========================================================================

HOW TO GET MINNEVIEW TO ROTATE ITS IMAGE, ETC.

With the left mouse button (the "master control") pressed down, cursor
motions in the MinneView window produce rotations of the object being
viewed.  If you stop moving the mouse before releasing the mouse
button then motion stops.  Otherwise it continues (after lifting your
finger) with speed depending on mouse velocity when released.  If the
right mouse button is pressed, menus appear which are subject to
experimentation.  All menu options have keyboard shortcuts indicated in
[brackets] in the menu.  Examples are

    r   rotate (default is on)
    t   translate
    z   zoom
    ESC quit
    w   Whereisit? (brings lost objects home)

==========================================================================

AUTOMATIC CENTERING IN MINNEVIEW

By default, when you display a sequence of objects in MinneView, each is
automatically scaled and translated independently to fit in a unit cube
centered on the origin.  An object which moves without changing shape
will seem not to change at all.  To see relative motions between
successive frames, press first the "3" then the "\#" key while the cursor
is in MinneView's window.  Specifically, the centering options are
        1 #    center each object independently (default)
        2 #    center the union of all objects
        3 #    apply the current object's centering transformation
                  to all future objects

==========================================================================

HOW TO CHANGE THE REFLECTIVE PROPERTIES AND LIGHTING OF AN OBJECT
BEING DISPLAYED

    medit 

This opens a medit window.  

There are several things which one can then adjust; changes are
immediately visible on medit's sphere.  MinneView notices the changes
whenever you move the mouse into the MinneView window.

 *  Change properties of the surface being viewed.  These are
    controlled by the three sliders on the left.

	"Shin" stands for shinyness.  It changes from plastic to metallic.

	"Ks" stands for specular highlight coefficient.

	"Kd" stands for diffuse light coefficient.

 *  Change the color of the surface being viewed.  With the cursor in
    the object color area, click and hold down the left mouse button
    and drag it to a spot on the screen where the desired color
    appears.  Once there release the mouse button.  This changes the
    color of the object to that color.

 *  Change the surface's highlight color.   Press and hold the keyboard
    ALT key.  Move the mouse to a point on the screen displaying the
    desired color, then click and release the left mouse button.


 *  Change the intensity of a light.  Click left mouse button with
    cursor on sphere.  The light closest to the cursor becomes the
    "current light".  Move cursor to right slider to adjust intensity
    with right mouse button.

 *  Change the color of a light.  Click left mouse button with cursor
    on sphere.  The light closest to the cursor becomes the "current
    light".  Press down middle mouse button with cursor in medit
    window.  Drag it to any other spot on the screen and release.
    That changes the color of the light to that color.

 *  Move a light.  Click on the light's highlight on the sphere.
    Dragging the corresponding highlight moves the light.

 *  Create or delete a light.  Click the right mouse button, and
    pick "create light" or "delete light" from the menu.  "Delete light"
    deletes the last light chosen by clicking on its highlight.


==========================================================================

HOW TO GET DESIRED COLORS ON THE SCREEN

    cedit

This opens an Iris window with sliders for producing any desired color.
Alternatively

    showmap

displays a good selection of existing colors.


==========================================================================

HOW TO CLEAN UP SHARED MEMORY

    smem -i

This deletes all shared memory segments. You should do this
occasionally if you use the ``stuff'' program. Only do this at times
when no program using shared memory (e.g. MinneView) is running.
