User Guide to Polygon Viewer
I wrote this simple polygon viewer to have one that I
understand completely and that I can easily use and modify
in the design of my applets. Its most significant
disadvantage is that it is slow compared to some others that
are available, and very slow compared to commercial software
(like Explorer) that is available on particular hardware
platforms. It also flickers more than I would like.
Presumably you came here since you were using the viewer on
some other page, and you need the documentation. However,
clicking on the cube nearby will bring up a window that you
can use to try out the things you'll read about on this
page. We'll refer to it as the Display Window and
call whatever is displayed in it the object.
Rotating the Image
The basic operation is a rotation of the object which generates
the three-dimensional effect. Think of the object you are
viewing as being contained in a transparent sphere. Move the
cursor to a point in the image, depress the mouse button, and
keep it down. That attaches the cursor to the sphere. Then
drag the mouse, with the mouse button still depressed. The
sphere, and therefore the object, will rotate. To save computer
time, and make the interaction a little more nimble, during the
rotation the polygons are displayed as outlines only. As soon
as you release the mouse button the object is displayed as
before. Try it now!
Secondary modes can be obtained by selecting certain menu
items or pressing the corresponding keys, as indicated
below. In all cases the viewer reverts to the rotation mode
automatically. So if for example you want to zoom twice you
have to reselect the zoom mode after zooming the first
time.
The Menus
There are two menus, the Mode Menu, and the Color
Menu. All menu items have equivalent key strokes, and
eventually you will probably find the key strokes more
convenient than the menus. Most Menu items toggle features
(i.e., turn them on and off).
The Mode Menu
-
Quit (x,X,q,Q): A suggested by the name, this
makes the display window disappear. You can accomplish
the same effect by clicking on the applet itself.
-
dragging (d): By default, the object follows the
mouse as you drag it. This times toggles that feature.
For complicated objects you may wish to run it off.
-
Wireframe (w): Toggles the drawing of the object
as colored polygons or as wireframes indicating depth.
-
color (c): With the wireframe display selected
color can be superimposed with this item.
-
fast (f): By default the object is drawn as an
outline only during rotation. This item turns that
feature on and off.
-
step (s): This item repeats the last rotation
caused by the mouse. Thus by repeatedly pressing s
you can continue the current rotation, with better
control than you have with the mouse.
-
rotate (r): Continues the last rotation
indefinitely until disabled by selecting this item again
or pressing r again.
-
zoom (z): Temporarily turns the rotation mode
into a zoom mode. After selecting this item dragging
the mouse to the right will move the object away,
dragging the mouse to the left will pull it closer.
Dragging the mouse vertically has no effect. As
described above, after the zoom action the program
switches back to rotation mode, so if you wish to zoom
again you have to type z first.
-
translate (t): Temporarily switches the rotation
mode to a translation made where the object is moved
while maintaining its apparent distance.
-
perspective (p): By default, the object is drawn
as it would appear from infinity. After selecting this
item, dragging the mouse to the right will move the
point of view close to the object, and similarly,
dragging the mouse to the left will move the point of
view farther away from the object.
-
reset (R): resets most of the defaults.
The Color Menu
-
many colors (m): By default each polygon is drawn
in a color that corresponds to its index number. The
alternative is to draw all polygons in the same color,
but distinguished by the amount of light they reflect to
the viewer. This items toggles between the two
possibilities. If the second option is in effect the
object can be drawn in one of the following colors:
-
blue (b): The default.
-
red (e)
-
green (g)
-
yellow (y)
-
white (h)
In all cases the light is obtained as a combination of
ambient light and two spot lights far away, one at the
left and one at the right of the object. The spot
lights do not turn with the transparent sphere.
-
Ambient(A): Working like the zoom and
translation controls, increases the contribution of
ambient light by dragging the mouse to the right, and
decreases it by dragging the mouse to the left.
-
Background (Z): Working like the Ambient
control, increases or decreases the intensity of the
background. Two background colors are currently
available:
-
white (W): the default, or
-
blue (B).
Both are by default displayed at maximum brightness.
Resizing the Display Window.
You can resize the display window
(like any window on your particular system)
and the drawing of the object should
automatically adjust itself to the new window. It's
likely that the larger the window the slower the
interaction with the object will be.
Known Bugs/Things to do.
-
Clicking on the applet to make the drawing window
disappear and then clicking again to make it reappear
causes the menus to be stripped off the drawing window.
This will be fixed, but in the mean time use the
keyboard if you loose the menu.
-
Toggling the wireframe item does not immediately change
the picture. You need to rotate the object first (which
may consist of the zero rotation obtained by double
clicking in the display window.)
-
Currently the polygon viewer is called from various main
programs that define hardcoded polygons. I'm
planning to build a version that reads the polygon
data from a file and that you can use to display your
own objects.
[17-Feb-1997]
Go to Peter Alfeld's Home Page.