Surface Evolver Documentation - Script Examples

# Surface Evolver Documentation

Back to top of Surface Evolver documentation. Index.

# Surface Evolver Script Examples

This page lists some sample command script files. Fuller descriptions are below. The files are included in the Evolver distribution in the `fe` folder, and thus should be on the EVOLVERPATH so Evolver can find them.

You read a script file into Evolver with the read command, for example

       Enter command: read "3ds.cmd"

In general, each script contains one main command, whose name is the same as the file name, e.g. `adjoint.cmd` contains the `adjoint` command, except for when this would result in an illegal name or a conflict with an Evolver keyword. Each file has usage instructions in the comments in the top of the file.

A list of the script files:

3ds.cmd adjoint.cmd adjointc.cmd ansys.cmd band.cmd bonnet_movie.cmd cmccousin.cmd coff.cmd collada.cmd complex.cmd dirichlet_to_disk.cmd dxf.cmd dxf_thick.cmd embox.cmd foamface.cmd foamface_jvx.cmd | fourier.cmd gaussequi.cmd gaussmap.cmd gaussref.cmd iges.cmd iges114.cmd iges128.cmd iges144.cmd intersect.cmd jvx.cmd maya.cmd maya1.cmd neville.cmd obj.cmd off.cmd offn.cmd | off_show.cmd order.cmd percolate.cmd ply.cmd polyfilm.cmd povray.cmd povrays.cmd quadbbox.cmd quadmeet.cmd quadtbox.cmd reorder.cmd rewrap.cmd rgb.cmd rib.cmd rotate.cmd save_view.cmd show_equi.cmd | simply_connected.cmd slice.cmd slice2.cmd slicer.cmd stl.cmd strdup.cmd strips.cmd tuber.cmd unseam.cmd unshear.cmd vrml.cmd vrml2.cmd wavefront.cmd wetfoam2.cmd x3d.cmd xray.cmd zebra.cmd

Of these, many people are particularly interested in scripts that can export files that other software can read, so here is a list of file export scripts. These generally work by running the command with the output re-directed to a file, for example

       Enter command: read "collada.cmd"
       Enter command: collada >>> "filename.cda"

Note that `>>>` results in over-writing any existing file of the same name.
The export script files:

3ds.cmd ansys.cmd coff.cmd collada.cmd dxf.cmd dxf_thick.cmd iges.cmd iges114.cmd iges128.cmd iges144.cmd jvx.cmd maya.cmd maya1.cmd | obj.cmd off.cmd offn.cmd off_show.cmd ply.cmd polyfilm.cmd povray.cmd povrays.cmd rib.cmd stl.cmd vrml.cmd vrml2.cmd wavefront.cmd x3d.cmd

### 3ds.cmd

Script to produce Autodesk 3DS format file.

Usage: `do_3ds >>> "filename.3ds"`

Assumptions: 3D soapfilm model, linear model, not torus or symmetry group (use the detorus command if necessary to convert torus or symmetry to unwrapped surface, but remember that detorus alters the surface).
Limited to 65535 facets.
Does facets only, not edges.
Facet color is frontcolor on both sides.

### adjoint.cmd

Script for the calculation of the adjoint minimal surface using Konrad Polthier's discrete conjugate method of Bonnet rotation. See

Ulrich Pinkall and Konrad Polthier, Computing Discrete Minimal Surfacee and Their Conjugates, Experim. Math. 2(1) (1993) 15-36

and

Konrad Polthier, Conjugate Harmonic Maps and Minimal Surfaces.

The "adjoint" of a smooth minimal surface is another minimal surface isometric to the first that has normals in the same direction at each point but the infinitesimal surface element rotated 90 degrees about the normal. Schwartz' P and D surfaces are adjoints of each other.

A "discrete minimal surface" is made up of flat triangles. It is called "conforming" if the vertices of adjacent triangles coincide, and "nonconforming" if adjacent triangles only meet at their midpoints. Polthier shows that if a conforming discrete minimal surface minimizes area, then it has an exact nonconforming adjoint.

The `adjoint` command in this file takes a conforming surface and calculates the nonconforming adjoint, then tweaks vertices to make it conforming, so it is a legal Surface Evolver surface.

Assumptions:

- 3D soapfilm model.
- Linear model.
- No torus or symmetry group.
- Each edge has only one or two adjacent facets.
- All facets have the same orientation. The original surface should be free of all level set constraints and boundaries before doing "adjoint"; fixed vertices and edges are ok.

Usage: `adjoint`

After `adjoint` has been run, you can flip back and forth between the original and the adjoint with the `flip` command.

Usage: `flip`

Before running `adjoint`, you can set the variable `starte` to the number of the edge whose midpoint will remain fixed in place; default is edge[1].

The angle of the Bonnet rotation is set by the variable `bangle`, which you may set to any degree value before doing `adjoint`. The default value of bangle is 90 degrees.

Also this file has the command `write_conjugate` to write a datafile to stdout that is the nonconforming discrete adjoint, with separated vertices. Use this to see Polthier's idea in its true form.

Usage: `write_conjugate >>> "filename.fe"`

For a slightly more elaborate approach using complex numbers for the adjoint coordinates, which is faster for doing multiple arbitrary rotations, see adjointc.cmd. This file and adjointc.cmd have non-overlapping namespaces, so both can be loaded simultaneously.

See my page on triply periodic minimal surface for examples created with `adjoint`.

### adjointc.cmd

Another script for the calculation of the adjoint minimal surface using Konrad Polthier's discrete conjugate method of Bonnet rotation. See

Ulrich Pinkall and Konrad Polthier, Computing Discrete Minimal Surfacee and Their Conjugates, Experim. Math. 2(1) (1993) 15-36

and

Konrad Polthier, Conjugate Harmonic Maps and Minimal Surfaces.

The "adjoint" of a smooth minimal surface is another minimal surface isometric to the first that has normals in the same direction at each point but the infinitesimal surface element rotated 90 degrees about the normal. Schwartz' P and D surfaces are adjoints of each other.

A "discrete minimal surface" is made up of flat triangles. It is called "conforming" if the vertices of adjacent triangles coincide, and "nonconforming" if adjacent triangles only meet at their midpoints. Polthier shows that if a conforming discrete minimal surface minimizes area, then it has an exact nonconforming adjoint.

The `adjointc` procedure in this file takes a conforming surface and calculates the nonconforming adjoint, then tweaks vertices to make it conforming, so it is a legal Surface Evolver surface.

Assumptions:

- 3D soapfilm model.
- Linear model.
- No torus or symmetry group.
- Each edge has only one or two adjacent facets.
- All facets have the same orientation.
- The original surface should be free of all level set constraints and boundaries before doing `adjointc`; but fixed vertices and edges are ok.

Usage: `adjointc( real bangle, integer origin_vertex )`
Arguments:

- `bangle` - Bonnet rotation angle in degrees.
- `origin_vertex` - id of the vertex to be kept fixed.

After `adjointc` has been run, one may do other Bonnet rotations more quickly by calling `bonnet_rotation()`

Usage: `bonnet_rotation(real bangle, integer origin_vertex )`
Arguments:

- `bangle` - Bonnet rotation angle in degrees.
- `origin_vertex` - vertex to be kept fixed.

Also this file has the command "write_conj" to write a datafile to stdout that is the nonconforming discrete adjoint, with separated vertices. Use this to see Polthier's idea in its true form.

Usage: `write_conj >>> "filename.fe"`

For a slightly simpler approach using just real numbers for the adjoint coordinates, see adjoint.cmd. This file and adjoint.cmd have non-overlapping namespaces, so both can be loaded simultaneously.

See my page on triply periodic minimal surfaces for examples of files `adjointc` can be used with.

### ansys.cmd

Command to produce file of ANSYS input for vertices, edges, and faces to produce a surface for ANSYS meshing. Beware this is a very simple-minded translation to ANSYS format.

Assumptions and limitations:

- 3D soapfilm model.
- Linear or quadratic model.
- No torus or symmetry group.
- Does not do color.
- Does all edges and facets, regardless of show status.
- Does not assume consecutive numbering of elements.

Usage: `ansys >>> "filename"`

### band.cmd

Command script to create triangulated bands bordering deisgnated edges and vertices. The purpose is to make extremely accurate borders on surfaces in PostScript files, since just drawing thick edges can lead to notching where interior facets are drawn afterwards.

WARNING: This command modifies the surface by creating a lot of tiny facets. You should use only on a disposable copy of your surface.

Assumptions:

- 3D soapfilm model.
- Linear model.

Usage:

1. Set `bandcolor` and `bandwidth` to desired values; `bandwidth` is the width of the band in surface coordinates on one side of an edge.
2. Set the edge attribute `inband` to nonzero for those edges to have band drawn along them.
3. Run `makeband`.

Example:

       read "band.cmd";
       bandwidth := 0.003;
       bandcolor := black;
       set edge inband on_constraint topcon;
       makeband
       set edge inband on_constraint leftcon;
       makeband
       set edge inband original==1;
       makeband

Note: If `makeband` has problems in corners and other tricky spots, run `makeband` several times on separate sets of edges. When setting `inband` for the later runs, make sure you zero out `inband` on the edges of the previous run. Notice the conditions in the example are Boolean, applied to all edges.

### bonnet_movie.cmd

Makes in-memory movie of Bonnet rotation of minimal surface, one frame per degree for 360 degrees. Uses adjoint.cmd, so has the same assumptions.

Usage:

1. Evolve initial minimal surface, remove all level-set constraints and boundaries, get nice view in graphics window.
2. Run `make_movie` to calculate rotations.
3. Run `show_movie` to see screen display of Bonnet rotation.
4. Run `movie` to see endlessly repeating display of Bonnet rotation.
5. Run `postscript_movie` to create sequence of PostScript files. The names of the PostScript files will be the datafilename with the frame number appended.

### cmccousin.cmd

A constant mean curvature (CMC) surface in R^3 has a "cousin" minimal surface in S^3, which is isometric to it and has tangent planes rotated by 90 degrees. In S^3, the translation is done through the quaternion group.

This representation uses the 4th coordinate as the quaternion scalar component, for better mapping between R^3 and S^3 at quaternion unit.

Datafiles should be set up in 4 dimensions, with S^3 implemented as the level set constraint x^2 + y^2 + z^2 + w^2 = 1

Works best if starting edge starte is toward the center of the surface rather than on the outside.

Contained in this file:

`s3_to_r3`:
  Converts minimal surface in S^3 to CMC 1 surface in R^3. Remove all constraints and boundaries before invoking.
`r3_to_s3`:
  Converts CMC 1 surface in R^3 to minimal surface in S^3. Remove all constraints and boundaries before invoking.
`centralize(integer v_id)`:
  Procedure that translates S^3 so given vertex is at (0,0,0,1).

### coff.cmd

Command script to print a Geomview color OFF file in ascii format.

Assumptions and limitations:

- 3D soapfilm model.
- Linear model.
- No torus or symmetry group. Use detorus first if necessary.
- Does facet color, but must be regular color, not rgb_colors.
- Facet frontcolor is used; backcolor ignored.
- Only facets that qualify under the current show facets criterion are listed.
- Edges are not done, since the OFF format does not include them.
- Does not assume consecutive numbering of elements.

Usage:

1. Read in the command file.
2. Set the "show facets" criterion (optional).
3. Run `coff` and redirect output to a file.

Example:

      Enter command: read "coff.cmd"
      Enter command: show facet where not fixed
      Enter command: coff >>> "filename.coff"

### collada.cmd

Command script for creating Collada format file for a surface.

Assumptions and limitations:

- 3D soapfilm model.
- Linear model.
- No torus or symmetry group. Use detorus first if necessary.
- Does facet color, but must be regular color, not rgb_colors.
- Facet frontcolor and backcolor are used.
- Only facets that qualify under the current show facets criterion are listed.
- Edges are not done.
- Does not assume consecutive numbering of elements.

Usage:

1. Read in the command file.
2. Set the show facets expression (optional).
3. Run `collada` and redirect output to a file.

Example:

      Enter command: read "collada.cmd"
      Enter command: show facet where not fixed
      Enter command: collada >>> "filename.col"

### complex.cmd

Some complex functions of complex arguments, mostly for use with Weierstrass representation of minimal surfaces. Each function has two versions, for returning the real and imaginary parts.

Contents:

- `re_sqrt(real rex,real imx), im_sqrt(real rex, real imx)`
- `re_sin(real rex,real imx), im_sin(real rex, real imx)`
- `re_arcsin(real rex,real imx), im_arcsin(real rex, real imx)`
- `re_incompleteEllipticF(real rex, real imx, real m_param, real nbr_value,integer nbr_test),
  im_incompleteEllipticF(real rex, real imx, real m_param, real nbr_value,integer nbr_test)`

Arguments:
`rex`,`imx`: real and imaginary parts of the complex argument.
Additional information on `incompleteEllipticF`: Have to beware branch points at +/- arcsin(1/sqrt(m)) + 2*pi*k, so the `nbr_value` input argument is for picking the proper branch by continuity; if 0, then the principle branch is picked. Branch values differ by 2*ellipticK(m). `nbr_test` is a boolean flag for whether to apply the aforementioned continuity test.
Reference: Abramowitz and Stegun 17.4.11

### dirichlet_to_disk.cmd

Command script for mapping simply connected regions to unit disk minimizing Dirichlet energy to get conformal mappings.

Prerequisites: 2D soapfilm model with simply connected surface. Dirichlet_elastic energy defined using a named quantity, but no others, i.e. all facets given tension 0.

Usage: Remove all constraints and boundaries. Run to_disk or to_triangle. Then evolve.

Sample datafile: dirichlet_E.fe

### dxf.cmd

Command script to produce AutoCad DXF files.

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does facet color, but just uses frontcolor; see dxf_thick.cmd for backcolor.
- Does not do edges.
- Does not need consecutive element numbering.

Usage: `dxf >>> "filename.dxf"`

### dxf_thick.cmd

Command script to produce AutoCad DXF files with separate facet frontcolor and backcolor.

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does facet frontcolor and backcolor by creating two slightly displaced facets if frontcolor and backcolor are different.
- Does not do edges.
- Does not need consecutive element numbering.

Usage: `dxf_thick >>> "filename.dxf"`

### embox.cmd

Command script to create body-enclosing facets around outside of a foam section created by using the detorus command on a foam that's being displayed in clipped mode.
Assumptions:

- 3D soapfilm torus model.
- Foam fills unit cell.
- No interior edges with valence 1 after detorus..
- torus_periods and inverse_periods still hold valid values, so embox cannot be run on a dump file made after detorus is done.

Usage: set torus mode view to clipped, run detorus, then `embox`.

WARNING: embox does not nicely handle facets that are exactly on the bounding box walls, so if there are any such facets, it is advised to move the surface BEFORE doing detorus, i.e.

         clipped;
         set vertex x x+0.1;
         set vertex y y+0.1;
         set vertex z z+0.1;
         detorus;
         embox;

### foamface.cmd

This file contains several command scripts useful in analyzing 3D foams in terms of full foam faces rather than Evolver facets.

Assumptions:

- 3D soapfilm model.
- Meant for torus model, but works without it just fine.
- Works with linear, quadratic, and Lagrange models.

There are five useful commands:

- `foamface_mark`: finds contiguous faces, and marks the facets of each contiguous face with the same value of the facet attribute `fmark`, whose value value ranges from 1 up to the number of full faces, which is kept in the variable `foamface_count`.
- `foamface_min`: finds the minimum area contiguous face. Runs `foamface_mark` itself, so you don't have to.
- `foamedge_mark`: finds contiguous triple edges, and marks the edges of each contiguous triple edge with the same values of the edge attribute `emark`, whose values from 1 up to `foamedge_count`.
- `foamedge_min`: finds the minimum length contiguous triple edge. Runs `foamedge_mark` itself, so you don't have to.
- `foam_signature`: finds number of polygons of each type on each body. When done, the array `body_poly_counts` holds number of faces of given sides for each body. After foam_signature, you can do

             print body_poly_counts

  to see the results. For example, for twointor.fe, which has two bodies, the result is

             {{0,0,0,6,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
              {0,0,0,6,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}

### foamface_jvx.cmd

Produces JavaView jvx file with foam cell faces as single jvx faces.

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does average of facet frontcolor and backcolor.
- Does transparency; set the variable `jvx_transparency` to the desired transparency, between 0 and 1, before running `foamface_jvx`.
- Does not do edges as such, but face edges do display.
- Does not need consecutive element numbering.

Usage: `foamface_jvx >>> "filename.jvx"`

### fourier.cmd

Procedure to print Fourier components for a closed curve. The curve is deemed to be the image of a unit circle into 3D, with the vertices being images of points uniformly spread around the circle. The sin and cos Fourier coefficients of the given order are computed and printed. The results are also stored in the variables `x_sin_coeff`, `y_sin_coeff`, `z_sin_coeff`, `x_sin_coeff`, `y_sin_coeff`, and `z_sin_coeff` for your convenience.

Assumptions:

- 3D linear string model.
- Not torus or symmetry model.
- The edges form a closed curve.

Usage: `f_component(integer order)`

### gaussequi.cmd

Command script to do edge equiangulation using the Gauss map for swap criterion. The Gauss map maps a surface to the unit sphere, each point being mapped to its unit normal vector. The facets of the original surface induce a triangulation of the Gauss sphere, and equiangulation can be calculated for the sphere triangulation. This command does that and does the indicated edge swaps. The idea is to make facets better follow curvature. But it has potential problems; it can produce zero area facets. Also, swapping an edge changes the Gauss map, so maybe things don't improve.

Assumptions:

- 3D linear soapfilm model.
- Torus model is allowed.

Usage: `gaussequi`

### gaussmap.cmd

The Gauss map maps a surface to the unit sphere, each point being mapped to its unit normal vector. This command script physically converts a surface to a spherical surface. It converts each vertex coordinate to its unit normal. The original coordinates are saved in the vertex vector attribute `oldx` so the `revert` command defined herein restores the original surface.

Assumptions:

- 3D linear soapfilm model.
- No torus model or symmetry group.
- No vertices should be on constraints or boundaries or be fixed.

Usage: `gaussmap`

### gaussref.cmd

Procedure to refine edges using the Gauss map for the refinement criterion. The Gauss map maps a surface to the unit sphere, each point being mapped to its unit normal vector. The facets of the original surface induce a triangulation of the Gauss sphere, and edge length can be calculated for the sphere triangulation. The idea is to refine edges on the basis of curvature rather than length, and keep the number of edges needed to a minimum.

Assumptions:

- 3D linear soapfilm model.
- Torus model is allowed. criterion arc length, in radians. Default

Usage: `gaussequi(real maxarc)`
where `maxarc` is the cutoff arclength for refinement, in radians.

### iges.cmd

Command script to write IGES file for surface, using IGES parametric patch entity (type 114).

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does facet color as frontcolor only.
- Does not do edges.
- Does not need consecutive element numbering.

Usage: `iges >>> "filename.igs"`

### iges114.cmd

Command script to write IGES file for surface, using IGES parametric patch entity (type 114). Different from iges.cmd in that it obeys the show facets criterion and also does quadratic and cubic models.

Assumptions and features:

- 3D soapfilm linear, quadratic, or Lagrange order 3 model.
- No torus or symmetry group; use detorus first if necessary.
- Does facet color as frontcolor only.
- Displays facets obeying the show facets criterion.
- Does not do edges.
- Does not need consecutive element numbering.

Usage: `iges114 >>> "filename.igs"`

### iges128.cmd

Command script to write IGES file for surface, using IGES rational B-spline entity (type 128).

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does facet color as frontcolor, but if you set the variable `iges_double_sided` to 1, then it will do front and back versions of each facet.
- Displays facets obeying the show facets criterion.
- Does not do edges as such, but if you set the variable `iges_edge_tubes` to 1, then each edge will be displayed as a long thin tube..
- Does not need consecutive element numbering.

Usage: `iges128 >>> "filename.igs"`

### iges144.cmd

Command script to write IGES file for surface, using IGES trimmed parametric surface entity (type 144).

Assumptions and features:

- 3D soapfilm linear, quadratic, or Lagrange order 3 model.
- No torus or symmetry group; use detorus first if necessary.
- Does facet color as frontcolor only.
- Displays facets obeying the show facets criterion.
- Does not do edges.
- Does not need consecutive element numbering.

Usage: `iges144 >>> "filename.igs"`

### intersect.cmd

Command script to detect intersection of linear edges and facets. For each facet, finds if any edge intersects in its interior.

Assumptions and features:

- 3D soapfilm linear, quadratic model. But in the quadratic model, treats edges and facets as simply linear.
- No torus or symmetry group.
- Slow for large surfaces, since it tests all edges each against all facets.
- Variable `intersect_eps` is the tolerance for being considered equal to zero, i.e. for detecting parallel or border-intersecting facets.

Usage: `detect`
Output: prints ids of facets and edges that intersect. Will not work in Lagrange model.

### jvx.cmd

Command script to create a JavaView jvx file.

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does facet color as frontcolor only.
- Displays facets obeying the show facets criterion.
- Displays edges obeying the show edges criterion.
- Does not need consecutive element numbering.

Usage: `jvx >>> "filename.jvx"`

### maya.cmd

Command script to write Maya ASCII file using one mesh for the whole surface. Reference: http://caad.arch.ethz.ch/info/maya/manual/FileFormats/index.html Also in Maya documentation: Developer Resources > File Formats > Maya ASCII file format > Maya ASCII f format > Organizationof Maya Ascii files

Assumptions and features:

- Doesn't seem to work properly yet. Use maya1.cmd for now.
- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does facet color as frontcolor only.
- Doesn't obey the show facets criterion.
- show edges criterion.
- Does not need consecutive element numbering.

Usage: `maya >>> "filename.ma"`

Note: The default length unit is cm, but if you want to use something different, then set the `maya_length_unit` variable to the appropriate string after loading maya.cmd and before running the `maya` command, e.g.

       maya_length_unit := "in"
       maya >>> "filename.ma"

Valid length unit strings are: "mm", "millimeter", "cm", "centimeter", "m", "meter", "km", "kilometer", "in", "inch", "ft", "foot", "yd", "yard", "mi", "mile".

Note: To prevent names generated by this script from conflicting with existing maya names or names from another datafile, there is a string variable `maya_name` that is prepended to all names generated by this script. There is a maya namespace feature that probably could be used in place of this, but I do not understand it yet. The `maya_name` default is "AAA"; I didn't use the datafilename since this may contain illegal characters and also would prevent generating multiple maya objects from the same datafile. So if you are going to use multiple surfaces simultaneously, change `maya_name` before executing the maya command.

### maya1.cmd

Command script to write Maya ASCII file using separate mesh object for each facet. Reference: http://caad.arch.ethz.ch/info/maya/manual/FileFormats/index.html Also in Maya documentation: Developer Resources > File Formats > Maya ASCII file format > Maya ASCII f format > Organizationof Maya Ascii files

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does facet color as frontcolor only.
- Doesn't obey the show facets criterion.
- show edges criterion.
- Does not need consecutive element numbering.

Usage: `maya1 >>> "filename.ma"`

Note: The default length unit is cm, but if you want to use something different, then set the `maya_length_unit` variable to the appropriate string after loading maya.cmd and before running the `maya` command, e.g.

       maya_length_unit := "in"
       maya >>> "filename.ma"

Valid length unit strings are: "mm", "millimeter", "cm", "centimeter", "m", "meter", "km", "kilometer", "in", "inch", "ft", "foot", "yd", "yard", "mi", "mile".

Note: To prevent names generated by this script from conflicting with existing maya names or names from another datafile, there is a string variable `maya_name` that is prepended to all names generated by this script. There is a maya namespace feature that probably could be used in place of this, but I do not understand it yet. The `maya_name` default is "AAA"; I didn't use the datafilename since this may contain illegal characters and also would prevent generating multiple maya objects from the same datafile. So if you are going to use multiple surfaces simultaneously, change `maya_name` before executing the maya command.

### neville.cmd

Procedures for Neville's algorithm for computing B-spline values. Several interpolations of distinct data can be done in one call.

Contents:

- `neville1` - interpolation and derivatives in one dimension
- `neville2` - interpolation and derivatives in two dimensions.

Usage of neville1: The global array `neville1_data` should be set up by caller, redimensioning if necessary.

      define neville1_data real[order+1][dim];
      // fill in node data in neville1_data
      ...
      neville1(order,dim,u);

where `u` is the value between 0 and 1 where the interpolation is desired. The input array neville1_data is not modified. The interpolated values and derivatives with respect to `u` are returned in the one-dimensional arrays `neville1_value[dim]` and `neville1_deriv[dim]`.

Usage of neville2: The global array `neville2_data` should be set up by caller, redimensioning if necessary.

      define neville2_data real[order+1][order+1][dim];
      // fill in node data in neville2_data
      ...
      // fille in the array nevill2_u[2] with the coordinates of the interpolation spot
      neville2_u[1] := 0.3;
      neville2_u[2] := 0.56;
      neville2(order,dim);

The input array neville2_data is not modified. The interpolated values and partial derivatives with respect to `u` are returned in the one-dimensional array `neville1_value[dim]` and the two-dimensional array `neville1_deriv[dim][2]`.

### obj.cmd

Command script for creating OBJ format 3D graphics file. The resulting OBJ file requires the file EvolverOBJcolors.mtl (included in the Evolver distribution fe folder) to be in the same folder to provide color information in same directory.

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does facet color as frontcolor only, unless the variable `obj_double_sided` is set to 1, in which case each facet will be drawn twice slightly apart.
- Obeys the show facets criterion.
- Obeys the show edges criterion.
- Edges are shown as lines, unless the variable `obj_edge_flag` is set to 1 (which is the default value). Edges are shown as 4-sided tubes. The relative size of the tubes can be set with the variable `tube_radius`, whose default value is 0.002.

Usage:

1. Set which edges and facets you want to show with the "`show edge where ...`" and "`show facet where ...`" commands.
2. Set `obj_double_sided` to 1 if you want back sides of facets.
3. Set `obj_edge_flag` to 0 if you want no edges shown.
4. Run `obj` and redirect output to file, for example
   `obj >>> "filename.obj"`

### off.cmd

Command script to print a Geomview OFF file in ascii format.

Assumptions and limitations:

- 3D soapfilm model.
- Linear model.
- No torus or symmetry group. Use detorus first if necessary.
- Does not do facet color.
- Does all facets. See off_show for the equivalent command obeying the facet show criterion.
- Edges are not done, since the OFF format does not include them.
- Does not assume consecutive numbering of elements.

Usage: `do_off >>> "filename.off"`

### offn.cmd

Command script to write a Geomview OFF file with normals. To permit sane handling of corners and junctions, multiple OFF vertices are created at such points, each with their different normals. The criterion for deciding whether a bend in the surface merits separate normals is the variable `cosine_cutoff` (default 0.8). Adjacent facets with normals whose angle between them has cosine less than the cutoff get separate vertices.

Assumptions and limitations:

- 3D soapfilm model.
- Linear model.
- No torus or symmetry group. Use detorus first if necessary.
- Does not do facet color.
- Does all facets.
- Edges are not done, since the OFF format does not include them.
- Does not assume consecutive numbering of elements.

Usage: `offn >>> "filename.off"`

### off_show.cmd

Command script to print a Geomview OFF file in ascii format. Different from off.cmd in obeying the facet show criterion.

Assumptions and limitations:

- 3D soapfilm model.
- Linear model.
- No torus or symmetry group. Use detorus first if necessary.
- Does not do facet color.
- Does facets that obey the facet show criterion.
- Edges are not done, since the OFF format does not include them.
- Does not assume consecutive numbering of elements.

Usage: `do_off >>> "filename.off"`

### order.cmd

Ccommand script to number string-model vertices consecutively. The result is an order number for each vertex in the vertex extra attribute `order_number`, which the script creates itself. It does not modify vertex or edge id numbers.

Assumptions:

- String linear model.
- All edges in a loop.

Usage: `order`
Example to use order and reorder_storage and renumber_all to get `id` numbering consecutive around a loop:

       define vertex attribute vertex_order_key real;
       define edge attribute edge_order_key real;
       define facet attribute facet_order_key real;
       define body attribute body_order_key real;
       define facetedge attribute facetedge_order_key real;

       read "order.cmd";

       renumber := {
         order;
         set vertex vertex_order_key order_number;
         set edge ee edge_order_key ee.vertex[1].vertex_order_key;
         set facetedge fe facetedge_order_key fe.edge[1].edge_order_key;
         set facet ff facet_order_key min(ff.vertex,vertex_order_key);
         set body bb body_order_key min(bb.facet,facet_order_key);
         reorder_storage;
         renumber_all;
         }

### percolate.cmd

Command scripts for percolation calculation on surfaces. "Percolation" refers to the connected of subnets of a network, as in water percolating through porous stone. Each edge of the network is deemed to be in an "on" or "off" state. A set of nodes that can be connected together with "on" edges is called a "cluster". Thus a particular choice of "on" edges partitions the original network into a set of disjoint clusters. The interesting phenomenon is that when edges are set "on" at random with a particular probability, there is a critical probability above which most of the network falls in one big cluster.

Assumptions and features:

- This file considers facets to be the "nodes".
- Works in both string and soapfilm models.
- Works in string and soapfilm models.
- Works in torus and symmetry models.
- Only edges with two adjacent facets are considered. In particular, triple edges in foams will not percolate.

Contents:

- `percolate` - calculates clusters of facets, and numbers each facet with a cluster number in the attribute "cluster_number".
- `slow_percolate` - slower, alternate algorithm for checking.
- `color_clusters` - colors facets according to cluster number (mod 16), with internal cluster edges the same color as the cluster and edges between clusters black.

Usage:

1. Set the `state` attribute of each edge to 0 for "off" or 1 for "on", for example
   `set edge state (random > 0.3)`.
2. Do `percolate` or `slow_percolate`.
3. Do `color_clusters` to see the clusters. In the string model, you should do "`show facets where 1`" to see the facets.

### ply.cmd

Command script to create PLY file (Stanford Polygon File Format) in ASCII ply format; does only front color of each facet. Format documentation: http://local.wasp.uwa.edu.au/~pbourke/dataformats/ply/

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does facet frontcolor only.
- Does edges and facets according to show criteria.
- Does not need consecutive element numbering.

Usage:

1. Set the edges and facets you want to output using the "`show edges where ...` " and "`show facets where ...` " commands.
2. Run ply and redirect to a file, like this:
   `ply >>> "filename.ply"`

### polyfilm.cmd

Command script to produce a Polycut format file.

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does not do color.
- Doesn't obey edges and facets show criteria.
- Does not need consecutive element numbering.

Usage: `polyfilm >>> "filename.poly"`

### povray.cmd

Command script for producing POV-Ray input file.

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does facet frontcolor only.
- Does edges and facets according to show criteria.
- Edges are implemented as cylinders.
- Does not need consecutive element numbering.

Usage:

1. Use the "`show edge where ...`" command to declare which edges are to be depicted as thin cylinders.
2. Set `edge_radius` to the desired radius of edge cylinders.
3. Use the "`show facet where ...`" command to set which facets to do.
4. Run `povray` and redirect to desired file, e.g.
   `povray >>> "something.pov"`

### povrays.cmd

Command script for producing POV-Ray input file. Like povray.cmd but with vertex normals for a smooth surface.

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does facet frontcolor only.
- Does edges and facets according to show criteria.
- Edges are implemented as cylinders.
- Does not need consecutive element numbering.

Usage:

1. Use the "`show edge where ...`" command to declare which edges are to be depicted as thin cylinders.
2. Set `edge_radius` to the desired radius of edge cylinders.
3. Use the "`show facet where ...`" command to set which facets to do.
4. Set `critcos` to the cosine of the critical angle between normals for facets to be regarded as smoothly joined.
5. Run `povray` and redirect to desired file, e.g.
   `povray >>> "something.pov"`

### quadbbox.cmd

Command scripts `eboxes` and `fboxes` for finding the bounding box for each facet or edge in the quadratic model. This is useful since quadratic facets and edges may extend beyond the vertices.

Assumptions and features:

- Quadratic model. Soapfilm model for `fboxes`.
- Any ambient dimension.
- No torus or symmetry group.
- Results left in the edge `ebox` or facet `fbox` array attributes. These have dimension [space_dimension][2], with minimum being the first and maximum the second entry in each dimension.
- `fboxes` automatically calls `eboxes`.

Usage: `fboxes`

### quadmeet.cmd

Command script for detecting intersection of quadratic facets in 3D.

Assumptions and features:

- Quadratic model.
- Space dimension 3.
- No torus or symmetry group.
- Runs in quadratic time, since it compares each pair of facets.
- Prints id numbers of pairs of intersecting facets.

Usage: `quadmeet`

### quadtbox.cmd

Command scripts `eboxes` and `fboxes` for finding the bounding box for each facet or edge in the quadratic torus model. This is useful since quadratic facets and edges may extend beyond the vertices. The bounding box is calculated in terms of normalized unit cell coordinates, i.e. the edge vectors of the unit cell are the basis vectors for the normalized coordinates.

Assumptions and features:

- Quadratic model. Soapfilm model for `fboxes`.
- Any ambient dimension.
- Torus model.
- Results left in the edge `ebox` or facet `fbox` array attributes. These have dimension [space_dimension][2], with minimum being the first and maximum the second entry in each dimension.
- `fboxes` automatically calls `eboxes`.

Usage: `fboxes`

### reorder.cmd

Command script illustrating how to re-order element storage in memory, using the reorder_storage command, to test the effect of memory storage on execution speed. Also, in preparation for using the renumber_all command to re-number elements.

This example reorders vertices in diagonal order, by their distance along the (1,1,1) direction. Other elements are reordered according to their vertices.

Usage: reorder

### rewrap.cmd

Command to rewrap torus vertices and edges to get them nicely within unit cell. This version does 3D and 2D. Moves vertices at most one period at a time, so you may have to repeat if things are very bad to start with. Uses the wrap_vertex builtin command.

Usage: `rewrap`

### rgb.cmd

Handy array `rgb_values[16][4]` of Surface Evolver's color RGB values in array form. Values are between 0 and 1. Fourth coordinate is alpha, value always 1.

### rib.cmd

Command script to write RenderMan RIB file for surface This version does facets only, on a light blue background. Viewpoint is the same as 's' command. Orthogonal projection.

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does facets only, not edges.
- Does facet frontcolor only.
- Obeys edges and facets show criteria.
- Does not need consecutive element numbering.

Usage: rib >>> "filename.rib"

### rotate.cmd

Procedure to rotate unfixed vertices by angle about z axis.

Usage: `rotate(angle)`
where angle is in radians.

### save_view.cmd

Command to save the view matrix in a form from which it can be read in to restore the view. Requires Evolver version 2.40 or later, since it uses array initialization syntax. Replaces saveview.cmd.

Usage:

    Enter command: read "save_view.cmd"
    Enter command: save_view >>> "something.view"
    ...
    Enter command: read "something.view"

### show_equi.cmd

Command script to color green those edges that satisfy the equiangulation criterion.

Usage: `show_equi`

### simply_connected.cmd

Command script to find seams for splitting a multiply-connected surface into a simply connected surface. Meant for setting up Bonnet rotations of triply-periodic minimal surfaces.

Usage: `mark_simply_connected`

### slice.cmd

Command script that calculates the length of intersection of a plane with the surface. See slice2.cmd for slicing a particular body. Does not modify the surface. The equation of the slice plane is

        slice_aa*x + slice_bb*y + slice_cc*z = slice_dd

where `slice_aa`, `slice_bb`, `slice_cc` and `slice_dd` are global variables the user should set before calling `slice`.

Usage: `slice`

Output: prints the length of slice, and the area inside the slice.

Note all area inside slice is counted as positive! Try not to slice exactly through vertices!!

### slice2.cmd

Procedure that calculates the length of intersection of plane with the surface of a particular body. Does not modify the surface. The equation of the slice plane is

        slice_aa*x + slice_bb*y + slice_cc*z = slice_dd

where `slice_aa`, `slice_bb`, `slice_cc` and `slice_dd` are global variables the user should set before calling `slice`.

Usage: `slice2(integer body_id)`

Output: prints the length of slice, and the area inside the slice. The length is saved in the global variable `lensum`, and the area is saved in `areasum`.

Note all area inside slice is counted as positive! Try not to slice exactly through vertices!!

### slicer.cmd

Command scripts to physically remove the surface on one side of a plane.

Commands included:

- `drawslice` - make new edges across facets along plane.
- `slicer` - make slice and dissolve all facets, edges, and vertices on negative side of the plane. Calls `drawslice`.

Usage: Set `slice_a`,`slice_b`,`slice_c`,`slice_d` variables so

        slice_a*x + slice_b*y + slice_c*z >= slice_d

is the side you want, and do `slicer`. The default plane is `slice_a` := 0, `slice_b` := 0, `slice_c` := 1, `slice_d` := .1

Output: truncated surface on positive side of the plane.

Try not to slice exactly through vertices!!

To mark the vertices and edges created by the current slicing, there are a vertex attribute `v_timestamp` and an edge attribute `e_timestamp` that are set to `slice_timestamp`, which is incremented each time slicer is called. This is to permit doing multiple slices in various directions and being able to identify which vertices and which edges are on which slice planes.

Works in the torus model by rewrapping wrapped edges that would be cut so unwrapped part is on positive side of cut plane.

### stl.cmd

Command script to create an STL file of the surface.

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does not do facet color.
- Does not do edges.
- Does not need consecutive element numbering.

Usage: `stl >>> "filename.stl"`

### strdup.cmd

Command script to write a datafile that is an n-fold covering of a string. Meant to generate multiple coverings of elastic figure 8's.

Assumptions:

- String linear model.
- Does not do torus model.
- All edges connected in one loop.
- The number of coverings is determined by the variable `dupnum`.

Usage: `dupnum := something; strdup >>> "filename.fe"`

### strips.cmd

Command scripts to color the surface facets in triangle strips, as would be done for graphics displays using triangle strips. In a triangle strip, each successive triangle is made by adding one more vertex, so the last three vertices form the last triangle. But see also the graphics window Y key.
Contents:

- `strips` - quick algorithm for coloring strips.
- `strips2` - slower algorithm that aims for longer strips by trying multiple possibilities for strip directions from starting triangle.

Assumptions:

- Soapfilm linear or quadratic model.
- Does torus model and symmetry models.

Usage: `strips`
Usage: `strips2`

### tuber.cmd

Procedure to put tubes around certain edges, for more reliable display of chosen edges. Note that this procedure does modify the current surface, rather than write a datafile. Also note the tubes created are just separate tubes for each edge; they are not connected to each other in any way, so they are really meant just for display.

`tuber` also works in the torus model; a new body is created for all the tube facets to be on, so they will display when "connected" display mode is in effect. However, the tubes are displayed independently of the other bodies, and tend to stick out in various directions.

The edges to be tubed should have their `intube` attribute set positive.

Usage: `tuber(real tube_radius,integer tube_sides, integer tube_caps)`
where
`tube_radius` is the radius of the tubes, `tube_sides` is how many sides on each tube, at least 3, and `tube_caps` is 0 for no caps, 1 for cone caps.

Example:

       set edge intube (on_constraint 1)
       tuber(0.01,6,0);

### unseam.cmd

Command script to split a surface along marked edges. These edges should divide the surface. The algorithm splits each edge into two edges with the same endpoints, then pops the vertices that have two gaps on either side.

Usage:

1. Set the edge attribute `unseam_mark` to nonzero for those edges you want to be split.
2. `unseam`

### unshear.cmd

Command script to get the torus fundamental region closer to rectangular. Works in either 2 or 3 dimensions. (eventually, just 2D now)

NOTE: `unshear` needs to change the torus periods, but can't directly since `torus_periods` is a read-only array (because it is remembered as a formula). So the assumption is that the shear entries of the `torus_periods` array are variables of particular names, `shearij` for `torus_periods[i][j]`. (remember indexing starts with 1)

Usage: `unshear`

### vrml.cmd

Command script to make VRML version 1 file for surface.

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does facet frontcolor as facet color.
- Does edges and facets according to show status.
- Does not need consecutive element numbering.

Usage:

- "`show edge where ...`" to show desired edges.
- Run `vrml` and re-direct output to file, e.g.
  `Enter command: vrml >>> "myfile.wrl";`

### vrml2.cmd

Command script to make VRML version 2 file for surface.

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does facet frontcolor as facet color.
- Does edges and facets according to show status.
- Does not need consecutive element numbering.

Usage:

- "`show edge where ...`" to show desired edges.
- Run `vrml2` and re-direct output to file, e.g.
  `Enter command: vrml2 >>> "myfile.wrl";`

### wavefront.cmd

Command script for producing a Wavefront format file for the surface, suitable for feeding to JavaView.
Contents:

- `wavefront` - Produces wavefront file without normals.
- `wavefrontn` - Produces wavefront file with normals.

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Does not do colors.
- Does facets according to their show status.
- Does not do edges.
- Does not need consecutive element numbering.

Usage:

1. Do "`show facet where ...`" to show desired facets.
2. `wavefront >>> "filename.obj"`

### wetfoam2.cmd

Command script to convert a dry foam (no Plateau borders) to a wet foam. It can convert a foam in a torus, or a bubble cluster in Euclidean space.
Dry foam assumptions:

- Linear soapfilm model in 3D ambient space.
- Works with or without torus model. But no other symmetry than torus.
- Edge valences should all be 2 or 3.
- All triple edges are in chains between tetrahedral vertices.
- Only one high valence edge per facet (will refine if finds more )
- Facet tension assumed to be uniformly 1.

Usage:

1. Set `spread` to the relative size of the border (default 0.2)
2. Run `wetfoam` with output redirected to desired file, e.g.
   `Enter command: wetfoam >>> "wetfile.fe"`

The resulting file has a Plateau border body, whose number is recorded in the variable `border_body`.

This file replaces `wetfoam.cmd`, which is now obsolete.

### x3d.cmd

Command script to make a x3d file for a surface.

Assumptions and features:

- 3D soapfilm linear model.
- No torus or symmetry group; use detorus first if necessary.
- Obeys edges and facets show criteria.
- Does both facet frontcolor and backcolor, with two copies of a facet if they are different.
- Does not do edges.
- Does not need consecutive element numbering.

Usage:

1. Use the edge and facet "show" commands to control which are done.
2. Run `x3d` and re-direct output to file, e.g.
   `Enter command: x3d >>> "myfile.x3d";`

### xray.cmd

Command script to produce an xray image of a 3D wet foam. Calculates liquid content on grid of probe lines. Plateau borders are detected as bounded by facets with less than 2/3 of the maximum facet tension. Outputs a PostScript file to stdout with a grid of grayscale pixels.

Usage:

1. Set `xgridsize` and `ygridsize` to the desired resolution, i.e. pixels across and down.
2. `xray >>> "filename.ps"`

The `xray` command will calculate the bounding box of the surface itself. Works in torus or non-torus mode. In torus mode, everything will automatically be wrapped back to the unit cell, so you don't have to worry about that.

### zebra.cmd

Command script to alternately color string edges black and white.

Usage:

1. Set `color1` and `color2` to the two colors you want, if the default black and white are not suitable.
2. `zebra`

Back to top of Evolver documentation. Index.