Surface Evolver Documentation: graphics

# Surface Evolver Documentation

Back to top of Surface Evolver documentation. Index.

# Surface Evolver graphics

Surface Evolver graphics consists of drawing edges and facets. There is a single graphics driver routine which produces colored edges and facets in 3D and sends them to a set of display routines. There are three main sets of display routines:

- Native screen graphics, built-in Evolver graphics of various qualities on various platforms,
- Interface to the Geomview 3D viewer, for Unix/Linux users without OpenGL/GLUT graphics compiled into Evolver,
- PostScript files, for everybody wanting to make 2D images for publications, web sites, etc.

Internal Evolver state information relevant to graphics:

- edge color
- facet color, frontcolor, and backcolor
- edge show expression
- facet show expression
- facet shading toggle
- facet brightness
- facet_colors toggle
- view matrix
- view transform expression
- transforms toggle
- torus model display mode: raw_cells, clipped, or connected
- surface thickness
- show_inner and show_outer toggles
- background color
- window_aspect_ratio variable

Datafile features that are relevant to graphics are:

- edge color
- facet color, frontcolor, and backcolor
- view transforms
- view transform generators
- viewing matrix

Main prompt commands that are relevant to all graphics are:

- `show`, `showq`, and `show_expr` for controlling which elements are displayed.
- `set edge color`
- `set facet color, frontcolor, backcolor`
- `transforms` toggle
- `transform_expr`
- `thickness`
- torus model display mode toggles: `raw_cells`, `clipped`, or `connected`
- `show_inner` and `show_outer` toggles

## Native screen graphics

The Surface Evolver has the ability to produce its own screen graphics directly. The Windows version has nice OpenGL/GLUT graphics, which should also be available on any Unix/Linux/Mac OSX system. The Mac OS 9 version has some simple graphics, and there is a primitive X-windows graphics module for Unix/Linux systems that for some reason can't do OpenGL. Those compiling unix versions must link in the appropriate graphics module.

Screen graphics appear in their own window but can be controlled by typing graphics commands at the "graphics command: " prompt in the main window. OpenGL graphics can also be controlled by mouse and keyboard actions in the graphics window.

Main prompt commands relevant to screen graphics:

- `s` for starting screen graphics and entering graphics command mode
- `D` or `autodisplay` for toggling automatic redraw when the surface changes. Default is automatic redraw.
- `close_show` for ending screen graphics

The native screen graphics view is controlled by a view transformation matrix, which may be specified in the datafile, and which is dumped by the `d` or `list topinfo` commands. The view matrix may be changed with graphics mode commands. The view matrix elements may be read or set at runtime by `view_matrix[i][j]`, where the indices start at 1. In particular, one can write command scripts to save and reload particular view matrices; see `saveview.cmd` in the distribution package. The view matrix does not affect geomview.

The display consists entirely of facets and edges. Special edges (fixed edges, boundary edges, constraint edges, triple edges, bare edges) are always shown, unless you make their color CLEAR. The individual facet edges can be toggled with the graphics mode command `e'.

## Graphics mode commands

When the native graphics display is invoked by the '`s`' command or the various ``show`' commands, the Evolver enters graphics mode, with the prompt `Graphics command: '. A graphics command is a string of letters followed by RETURN. Each letter causes an action. Some commands may be preceded by an integer count of how many repetitions to do. Example command: `15u2z`, which does '`u`' 15 times and '`z`' twice. Rotation commands may be preceded by a real number giving the degrees of rotation; an integer will give a repetition count with the default angle of 6 degrees. A real number is indicated by including a decimal point.

#### Repeatable commands:

`u`
  Graphics mode command. Tip up. Rotates image about horizontal axis, default 6 degrees. Example: `15u' does 90 degree rotation, `15.0u' does 15 degree rotation.
`d`
  Graphics mode command. Tip down. Rotates image other way, default 6 degrees. Example: `15d' does 90 degree rotation, `15.0d' does 15 degree rotation.
`r`
  Graphics mode command. Rotate right. Rotates about vertical axis, default 6 degrees. Example: `15r' does 90 degree rotation, `15.0r' does 15 degree rotation.
`l`
  Graphics mode command. Rotate left. Rotates about vertical axis, default 6 degrees. Example: `15l' does 90 degree rotation, `15.0l' does 15 degree rotation.
`c`
  Graphics mode command. Rotate clockwise about center of screen, default 6 degrees. Example: `15c' does 90 degree rotation, `15.0c' does 15 degree rotation.
`C`
  Graphics mode command. Rotate counterclockwise about center of screen, default 6 degrees. Example: `15C' does 90 degree rotation, `15.0C' does 15 degree rotation.
`z`
  Graphics mode command. Zoom. Expands image by factor, default 1.2. Examples: `z' zooms by 1.2, `2z' zooms by 1.44, '2.0z' zooms by 2.
`s`
  Graphics mode command. Shrink. Contracts image by factor, default 1.2.
arrow keys
  Graphics mode command. Move image in appropriate direction. May be prefixed by a real number, which is multiple of thirds of screen width to move. Default move is 1/12 screen width. May not work on all terminals.

#### Non-repeatable commands:

`R`
  Graphics mode command. Reset viewing angles to original defaults and rescale the image to fit the viewing window.
`m`
  Graphics mode command. Center image in viewing window.
`e`
  Graphics mode command. Toggle showing all the facet edges.
`h`
  Graphics mode command. Toggle hiding hidden surfaces. When ON, takes longer to display images, but looks better.
`b`
  Graphics mode command. Toggles display of bounding box. Useful for visualizing orientation. In the native graphics window, the 'o' key does the same thing.
`t`
  Graphics mode command. Reset mode of displaying torus model. Choice of raw unit cell, clipped unit cell, or connected bodies.
`w`
  Graphics mode command. Toggles display of facets entirely on constraints. For a one-sided constraint, applies to facets whose vertices all hit the constraint. "w" stands for "wall".
`B`
  Graphics mode command. Toggles display of facets on boundaries or equality constraints.
`v`
  Graphics mode command. Toggles showing of convex and concave edges in different colors. "v" stands for "valleys".
`+`

  Graphics mode command. Increments color number used for facet edges.
`-`
  Graphics mode command. Decrements color number used for facet edges.
`?`
  Graphics mode command. Prints help screen for graphics commands.
`q` ,x
  Graphics mode command. Exit from graphics mode, and return to main command mode.

  ## OpenGL graphics

  Ideally, you have a version of the Evolver that uses OpenGL/GLUT for its screen graphics. OpenGL is standard on Mac OSX, most unix systems, and Microsoft Windows. Tbe graphics display is invoked with the 's' command, which leaves you at the graphics prompt, which you should quit 'q' right away since graphics commands are better given in the graphics window. There are many mouse and keyboard actions that can be performed in the graphics window itself. Holding down and dragging the left mouse button moves the surface continuously, and the clicking right mouse button picks vertices, edges, and facets. Picked element id numbers are printed in the console window. With the graphics window in the foreground, these keyboard commands are active:

  h | Print a help screen on the console window.
  r | Rotate mode for left mouse button.
  t | Translate mode for left mouse button.
  z | Zoom mode for left mouse button (and use F to focus on particular vertex).
  c | Clockwise/counterclockwise spin mode for left mouse button.
  + | Widen edges.
  - | Narrow edges.
  b | Decrement edge front bias by .001.
  B | Increment edge front bias by .001 (to show edges more clearly).
  R | Reset the view.
  m | Center the image.
  M | Have the right mouse button bring up a menu instead of picking.
  P | Have the right mouse button do picking instead of menu (default).
  p | Toggle orthogonal/perspective projection.
  s | Toggle cross-eyed stereo.
  e | Toggle showing edges, regardless of "show edge" condition.
  f | Toggle showing facets obeying "show facet" condition or no facets.
  F | Move the rotate/zoom origin to the last picked vertex.
  G | Start another graphics window with independent camera.
  o | Toggle drawing a bounding box.
  g | Toggle Gourard (smooth) shading.
  x | Close the graphics window.
  arrow keys | Translate a bit.
  | And some more advanced commands most users will never use, but are listed here for completeness:
  H | Print advanced help.
  a | Toggle using OpenGL element arrays.
  i | Toggle interleaved elements in OpenGL arrays.
  I | Toggle indexed OpenGL arrays.
  S | Toggle OpenGL triangle strips.
  Y | Toggle strip coloring (I was curious as to what OpenGL triangle strips would look like).
  D | Toggle using a display list.
  Q | Toggle printing drawing statistics.

  ## Geomview graphics

  Excellent screen graphics on Unix systems can be done through the free 3D viewing program geomview. Geomview can be started with the P command, option 8. One caution: geomview does not deal well with object sizes below 1e-5, so displaying micron-size objects using MKS units is ill-advised.

  Main prompt commands relevant to geomview:

  - `geomview` or `P 8` to start geomview
  - `P 9` to end geomview
  - `geompipe` to pipe geomview input someplace else
  - `geomview` string to send user commands to geomview
  - `gv_binary` toggle to control interface mode
  - `view_4D` to toggle sending 3D or 4D info to geomview
  - D or autodisplay for toggling automatic redraw when the surface changes. Default is automatic redraw when geomview is started.

  ## Picking elements.

  One of the big advantages of using geomview or the OpenGL version is that you can pick vertices, edges, and facets in the geomview window by right-mouse-clicking, and the id numbers of the picked objects will be printed in the main window. Be careful when picking; it does not always work as you might hope. It may be necessary to zoom in on the surface to get a clear shot at the element you want. Be wary when the element returned is 1; that seems to be a common response when Evolver is confused as to what element was picked. Also, Evolver polls geomview for pick results only when at a prompt awaiting user input.
  Picked vertex, edge, and facet numbers are stored in the internal variables `pickvnum`, `pickenum`, and `pickfnum`, respectively. The 'F' key command on the graphics window sets the rotation and scaling center to the pickvnum vertex. Pickvnum is settable with ordinary assignment commands, so the user can zoom in on any vertex desired.

  Note: Since vertices are not drawn individually, Evolver reports a vertex as picked only when two edges with a common vertex are simultaneously picked. Therefore a vertex at the end of a single edge cannot be picked.

  ## PostScript files

  The Surface Evolver can generate PostScript files by either the postscript command or the `P` command option 3, or just "P 3". The image is the same one shown with the native screen graphics, so one should use the `s` command and graphics mode commands to get the image looking as desired. The variable brightness can be used to set the median gray level. The PostScript image is put into an 8 inch square at the lower left of the page.

  With the P command, you will be prompted for options.

  `Show grid lines?`
    This is asked if you are graphing a 2D surface. If you reply 'y', all triangle edges will be plotted. If 'n', only special edges will be plotted (triple junctions, borders, etc.; this can be controlled with the `show edges` command). Default 'n'. The postscript command uses the gridflag toggle to control this.
  `Do colors?`
    If you reply 'y', edges and facets will be plotted with their color attributes and shading (if activated). If 'n', then all edges are plotted as black, and all facets as white with shading. Default 'n'. The postscript command uses the ps_colorflag toggle to control this.
  `Do crossings?`
    This is asked if the surface is 1-dimensional (the string model) and the dimension of space is at least 3. If you reply 'y', a 3D effect will be created by plotting edges back to front, with each edge plotted first as a thick white line and then as a thin black line. This creates a broken back line and continuous foreground line at each crossing. Default 'n'. The postscript command uses the crossingflag toggle to control this.
  `Do labels? (i for ids, o for originals)`
    This PostScript P 3 command subprompt gives you a chance to put numeric labels on vertices, edges, and facets, which is useful for debugging or modifying a datafile. Edge labels are slightly displaced toward the head of the edge, and facet labels are signed according to which side of the facet is visible. Choose 'i' or 'y' for the current element id, or 'o' for the original element number. If you don't want any labels, just hit RETURN. The postscript command uses the ps_labelflag toggle to control this. The relative size of the labels can be controlled with the `ps_labelsize` variable, whose default value is 3.0.
  `Enter file name (.ps will be added):`
    Give the name of the PostScript output file. A "`.ps`" extension will be added if "`.ps`" or "`.eps`" is missing. Not a good idea to just hit RETURN, since that will produce the file "`.ps`".
  The linewidth of PostScript edges may be controlled by the user. Widths are relative to the image size, which is 3 units square. If the real-valued edge extra attribute `ps_linewidth` is defined, that value is used as the edge width. Otherwise some internal read-write variables are consulted for various types of edges, in order:
  `ps_stringwidth` - edges in the string model, default 0.004
  `ps_bareedgewidth` - "bare" edges, no adjacent facets, default 0.005
  `ps_fixededgewidth` - "fixed" edges, default 0.004
  `ps_conedgewidth` - edges on constraints or boundaries, default 0.004
  `ps_tripleedgewidth` - edges with three or more adjacent facets, default 0.003
  `ps_gridedgewidth` - other edges, default 0.002
  The bounding box listed in the PostScript file is normally the actual extent of the surface in the window (i.e. the bounding box is never bigger than the window, but may be smaller). The full_bounding_box toggle will force the bounding box to be the full window. This is useful in controlling the image size while making a series of images of different views or evolution stages of a surface.

  Back to top of Surface Evolver documentation. Index.