OFF Tools


This page contains several tools for manipulating and/or creating OFF files. These tools were mostly written to solve small, specific tasks in the course of a larger project. The OFF files they utilize can be viewed with RoffView, my OFF viewing program. More information about the OFF file format can also be found at that link. Some of the algorithms implemented below are also part of MeshMan, a more recent OFF modeling program of mine.

The tools here were developed with the Java 1.3 VM. They should work on any later version of Java as well. The tools are very basic command-line programs, and probably work well on any Java-enabled platform.

Catmull-Clark Subdivider
catmullclark.jar

Syntax: java -jar catmullclark.jar inputfile outputfile
Given an OFF file inputfile, creates a new OFF file outputfile containing the input mesh after one iteration of Catmull-Clark subdivision.

Doo-Sabin Subdivider
doosabin.jar

Syntax: java -jar doosabin.jar inputfile outputfile
Given an OFF file inputfile, creates a new OFF file outputfile containing the input mesh after one iteration of Doo-Sabin subdivision.

Cuber - Cube Creator
cuber.jar

Syntax: java -jar cuber.jar side-length outputfile
Generates an OFF file outputfile containing a cube with the specified length of sides in polygons. Each face of the cube consists of side-length * side-length square polygons. The cube is centered around the origin, and has side-length cubed volume. It is oriented such that CCW traversal gives the outward normals.

CleanOff - Vertex Merger
cleanoff.jar

Syntax: java -jar cleanoff.jar inputfile outputfile [epsilon]
Given an OFF file inputfile, creates a new OFF file outputfile with vertices that were "near" each other in the original mesh merged into a single vertex in the new mesh. The optional epsilon parameter controls how near vertices must be to be merged. If no epsilon is specified, an epsilon of Float.MIN_VALUE is used. The optimal epsilon to specify depends upon the scale of your source data and the desired merging effect.

This tool supports the NOFF variety of OFF, with normals given for each vertex. In this case, the same epsilon test is applied to the normals. Vertices with "identical" locations but different normals will not be merged.

OffColor - Vertex Color Creator
offcolor.jar

Syntax: java -jar offcolor.jar oldfile red-colormap green-colormap blue-colormap outputfile
Given an OFF file oldfile, creates a new OFF file outputfile with per-vertex colors (In the COFF or CNOFF type of OFF). The three colormap parameters are the names of files. These files should be in my own simple colormap format. Together the files define colors for each polygon in the original OFF. The per-vertex colors in the new file are the average of the colors of the polygons in the star of each vertex. (Those polygons touching the vertex). The three colormaps need not be distinct files. Using the same file for each component will generate a greyscale output file.

Tess - Tessellator
tess.jar

Syntax: java -jar tess.jar inputfile outputfile
Given an OFF file inputfile, creates a new OFF file outputfile containing only triangles. The new file contains precisely the same vertices, but all polygons with four or more sides have been broken down into triangle fans. It is assumed that the input file consisted of planar polygons. If the input file has concave polygons with five or more sides this is detected, the tool terminates with an error message, and no output file is generated. Concave quadrilaterals are handled correctly, and do not cause an error. No checks are made for self-intersecting polygons, and no checks are made for polygons that intersect other polygons.

This tool supports the texture coordinates (ST), per-vertex colors (C) and per-vertex normals (N) varieties of OFF files. Per-polygon color information, if any exists, is not read and is not carried through the operations.

PatchOff - Bézier Patch to OFF Converter
patchoff.jar

Syntax: java -jar patchoff.jar configfile inputfile outputfile
Given a BPT file inputfile, creates a new OFF file outputfile containing triangles or quadrilaterals derived from the Bézier patches in the BPT file, according to the parameters given in the configuration file configfile. The configuration file and BPT file formats are explained here, along with descriptions of the capabilities of PatchOff and sample input and configuration files. The resulting OFF or NOFF file will have duplicate points along the edges of adjoining patches, if any such patches are defined in the BPT. CleanOff, above, may be used to merge these if desired.


Page contents copyright 2002, 2003, Ryan Holmes
The RoffView Home Page
My Home Page