Documentation for evmovie

Contents:

Introduction

Evmovie is a program that can display a series of Surface Evolver surfaces and let the user scroll back and forth through the series. Features:

Programmer: Ken Brakke, Susquhanna University, Selinsgrove, PA 17870, USA, brakke@susqu.edu.


Download and installation:

Microsoft Windows:

evmovie-Win32.zip has Download the zip file and unpack into a folder of your choosing, such as C:\evmovie.
To run the sample movie: Open a DOS window and change to that folder. Then run the DOS command
 evmovie testmovie\*.offb
To make the evmovie program available for your movie files:

Unix, Linux, Mac:

evmovie.tar has Download the tar file and unpack it in a folder.
To make the executable: Open a terminal window, change to the evmovie folder, and run "make".
To run the sample movie: Open a terminal window and change to the evmovie folder. Then run the shell command
   ./evmovie  testmovie/*.offb
To make evmovie available in movie file folders: I suggest you copy the evmovie executable file to a directory on your PATH (such as /usr/local/bin). Otherwise you can invoke it from by typing its absolute path, or, as a last resort, copy it into each folder where you have movie files.

Startup:

Evmovie is run from a command line, mostly because it needs a large list of files as arguments, and this is easiliy done with a command line and wildcards. Start evmovie with the list of frame files in order on the command line, for example
   evmovie frame*.offb
The wildcard should be expanded into an alphabetical list of files, not numerical order, so be sure your frame files are appropriately named. A name style like frame-0001.offb, frame-0002.offb, ... will work much better than freme-1.offb, frame-2.offb, ...
After evmovie starts, it reads the first lines of all the frame files, to chech if they are all present and readable. With hundreds or thousands of frames possible, this may take a while, so evmovie prints out frame numbers every once in a while as it does this. Then evmovie prints a message about how many frame files it found, and how many it thinks it can fit into memory at once. The first frame file is read in and the display window popped up. Further frame files are read in on demand; if there is not enough room in memory, then the least-recently-used frame is replaced in memory. Therefore the total number of frames is limited by disk space, not RAM.

Buttons and slider:

The frame position in the movie can be controlled by clicking the left mouse button in the bottom control strip:

3D graphics control:

The view of the object can be controlled by left-button clicking and dragging in the main part of the display window. There are several possible modes, which can be toggled between by hitting keys or using the right-button menu:

Other key commands:

Note: The smooth shading algorithm used is rather crude; to get the normal at a vertex, it just averages the normals of all adjacent facets. It assumes all facets are consistently oriented; if not, you will get funny shading bands where the orientation is inconsistent. Also, the algorithm does not understant triple lines, so those may have funny shading also.

Frame file creation

Each movie frame requires its own file. There are both ascii text and binary formats for the frame files. The binary format is preferred, since it is more compact, but I also have the ascii format since it was easier to debug with.

Frame files record the geometry of the surface only, so the particular view of the surface in Evolver graphics is irrelevant (unlike the Evolver postscript command, which uses the current view).

Built-in Evolver command: As of version 2.29, the Surface Evolver has a built-in command binary_off_file that creates a binary frame file for the current surface. The syntax is

    binary_off_file string
where string is a double-quoted string, a string variable, or a string-producing expression, typically using sprintf. Here is a simple Evolver script for producing a movie with one frame for each iteration:
   for ( frame := 1 ; frame <= 1000 ; frame += 1 )
   { binary_off_file sprintf "frame-%04d.offb", frame;
     g;
   }
Note that the %04d format generates zero-padded numbers in the frame file name, so alphabetical order is the same as numerical order.

The facets and edges that are included in the frame file are those for which the facet or edge "show" expressions are true. By default, all facets are shown, and all special edges (edges that are fixed, valence not two, on constraints, or on boundaries). Facet and edge colors are also recorded.

If special viewing modes are in effect, such as torus connected bodies, torus clipped, view transforms, or clipping planes, then these will also affect the facets and edges generated by binary_off_file.

Evolver script for ASCII frame files: If, for some reason the built-in binary_off_file command does not suit your needs, you can create your own frame files. Here is a sample Evolver script:


// Surface Evolver command to print ascii OFF file.
// usage:
//   do_off >>> "filename.off"

// Surface Evolver command to print OFF file in a modified
// ascii format.  Difference is each facet is followed by
// one color index integer rather than integer plus color components.

define vertex attribute off_number integer;
do_off := {
   local inx,fcount,ecount;

   // Consecutive index numbers for vertices
   inx := 0;
   foreach vertex vv do 
   { vv.off_number := inx;
     inx += 1;
   };
   fcount := sum(facet,show);
   ecount := sum(edge,show);

   // file header is ascii
   printf "OFF\n";
   printf "%d %d %d\n",vertex_count,fcount,ecount;

   // vertex list
   foreach vertex do { printf "%f %f %f\n",x,y,z };

   // triangle list
   foreach facet ff where ff.show do 
   { printf "%d ",3;
     foreach ff.vertex vv do printf "%d ",vv.off_number;
     printf "%d\n",ff.color;
   };

   // edge list
   foreach edge ee where ee.show do 
   { printf "%d ",2;
     foreach ee.vertex vv do printf "%d ",vv.off_number;
     printf "%d\n",ee.color;
   };

}

Evolver script for binary frame files

// offb.cmd
// Surface Evolver command to print OFF file in a modified
// binary format.  Difference is each facet is followed by
// one color index integer rather than integer plus color components.
// usage:
//   do_off >>> "filename.off"

define vertex attribute off_number integer
do_offb := {
   local inx,fcount,ecount;

   // Consecutive index numbers for vertices
   inx := 0;
   foreach vertex vv do 
   { vv.off_number := inx;
     inx += 1;
   };
   fcount := sum(facet,show);
   ecount := sum(edge,show);

   // file header is ascii
   printf "OFF BINARY\n";
   binary_printf "%ld%ld%ld",vertex_count,fcount,ecount;

   // vertex list
   foreach vertex do { binary_printf "%f%f%f",x,y,z };

   // triangle list
   foreach facet ff where ff.show do 
   { binary_printf "%ld",3;
     foreach ff.vertex vv do binary_printf "%ld",vv.off_number;
     binary_printf "%ld",ff.color;
   };

   // edge list
   foreach edge ee where ee.show do 
   { binary_printf "%ld",2;
     foreach ee.vertex vv do binary_printf "%ld",vv.off_number;
     binary_printf "%ld",ee.color;
   };
}
Frame files by other programs: Frame files may be generated by other programs such as Mathematica or CAD programs, as long as you can get them to output files in one of the frame file formats described below.

File formats

The frame file format is like OFF, except each facet has a color number added. (see OFF format)

There are two formats: ASCII text, and binary. The ASCII format is good for developing frame file generating software, since it is easier to debug, but the binary format is more compact and quicker to load into evmovie.

The color indices used are copied from the Surface Evolver, and are:

   0 BLACK,  
   1 BLUE,
   2 GREEN,
   3 CYAN,
   4 RED,
   5 MAGENTA,
   6 BROWN,
   7 LIGHTGRAY,
   8 DARKGRAY,
   9 LIGHTBLUE,
  10 LIGHTGREEN,
  11 LIGHTCYAN,
  12 LIGHTRED,
  13 LIGHTMAGENTA,
  14 YELLOW,
  15 WHITE
ASCII file format:
  line 1: OFF
  line 2: nv nf ne
    where nv is the number of vertices, 
          nf is the number of facets
          ne is the number of edges (yes, edges last)
  lines 3 to 2+nv:
    three floating point numbers per line, coordinates of a vertex
  lines 3+nv to 2+nv+nf:
    3 v1 v2 v3 c
    where 3 is the number of vertices in the polygon (from OFF format,
      but 3 is the only number evmovie recognizes),
    v1, v2, v3 are the vertex numbers of the facet in the vertex list,
      using 0 based indexing,
    c is the color of the facet, an integer from 0 to 15, being the
      same color number used by Evolver.
  lines 3+nv+nf to 2+nv+nf+ne:
    2 v1 v2 c
    where 2 is the number of vertices in the edge,
    v1, v2 are the vertex numbers of the edge ends in the vertex list,
      using 0 based indexing,
    c is the color of the facet, an integer from 0 to 15, being the
      same color number used by Evolver.
    Only special edges that should always be shown should be in this list.
Binary file format:
  line 1 is ascii, ending with newline: OFF BINARY
  The rest of the file is the same format as the ascii version, but
  with 4-byte ints and 4-byte floats and no newlines.  So the
  length of the file after the first line is 3 + nv*4*3 + nf*4*5 + ne*4*4. 
  The program tries to automatically detect big-endian vs little-endian
  format by seeing which gives the correct filesize.

End of evmovie documentation.