OFF-format

AUTHOR: Dr. Gerd Döben-Henisch
FIRST DATE: December 27, 1995
DATE of LAST CHANGE: January 5, 1996



For the description of basic objects in a type A world we are using a simplified version of the OFF-format of geomview.

`OFF' files (name for "object file format") represent collections of planar polygons with possibly shared vertices, a convenient way to describe polyhedra. The polygons may be concave but there's no provision for polygons containing holes.
br> Syntax:

[4]OFF		# Header keyword
NVertices  NFaces  NEdges   # NEdges not used or checked

x[0]  y[0]  z[0]	# Vertices, possibly with colors
			# If 4OFF, each vertex has 4 components,
			# including a final homogeneous component.
...
x[NVertices-1]  y[NVertices-1]  z[NVertices-1]

    			# Faces
    			# Nv = # vertices on this face
    			# v[0] ... v[Nv-1]: vertex indices
    			#		in range 0..NVertices-1
Nv  v[0] v[1] ... v[Nv-1]  colorspec
...
    			# colorspec continues past v[Nv-1]
    			# to end-of-line; may be 0 to 4 numbers
    			# nothing: default
    			# 1 integer: colormap index
    			# 3 or 4 integers: RGB[A] values 0..255
			# 3 or 4 floats: RGB[A] values 0..1

An OFF file may begin with the keyword OFF; it's recommended but optional, as many existing files lack this keyword.

Three ASCII integers follow: NVertices, NFaces, and NEdges. Thse are the number of vertices, faces, and edges, respectively. Current software does not use nor check NEdges; it needn't be correct but must be present.

The vertex coordinates follow: dimension * Nvertices floating-point values. They're implicitly numbered 0 through NVertices-1. dimension is either 3 (default) or 4 (specified by the key character 4 directly before OFF in the keyword).

Following these are the face descriptions, typically written with one line per face. Each has the form

N  Vert1 Vert2 ... VertN  [color]
Here N is the number of vertices on this face, and Vert1 through VertN are indices into the list of vertices (in the range 0..NVertices-1).

The optional color may take several forms. Line breaks are significant here: the color description begins after VertN and ends with the end of the line (or the next # comment). A color may be:

nothing
the default color
one integer
index into "the" colormap; see below
three or four integers
RGB and possibly alpha values in the range 0..255
three or four floating-point numbers
RGB and possibly alpha values in the range 0..1

The meaning of "default color" varies. If no face of the object has a color, all inherit the environment's default material color. If some but not all faces have colors, the default is gray (R,G,B,A=.666).



Example 1: OFF = cube
Example 2: OFF = cylinder


Comments are welcomed to kip-ml@inm.de
INM

Daimlerstrasse 32, 60314 Frankfurt am Main, Deutschland. Tel +49- (0)69-941963-0, Tel-Gerd: +49- (0)69-941963-10