OFF format description
This text is based on the
OFF format description in the
Geomview Documentation and
has been edited to describe the features supported by the Antiprism programs.
See also -
Geomview OOGL Tutorial.
OFF Files in Antiprism
The conventional suffix for OFF files is '.off'.
Syntax:
OFF # Header keyword
NVertices NFaces NEdges # NEdges not used or checked
x[0] y[0] z[0] # Vertices, any extra data is ignored
...
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
# integer: colormap index
# 3 or 4 integers: RGB[A] values 0..255
# 3 or 4 floats: RGB[A] values 0..1
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.
An OFF file must begin with a header line that includes the keyword
OFF;
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.
The vertex coordinates follow: 3 floating-point values. They are
implicitly numbered 0 through NVertices-1.
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 a colormap, the index numbers can be converted to color
values using the off_color program.
- 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
For display purposes a two-vertex face may be used to hold
an edge color, and a one-vertex face may be used to hold a vertex
color.
Antiprism treats the colour (0.0, 0.0, 0.0, 0.0), completely
transparent black, as a non-display color.
A value of '1' is valid in both the integer and floating point
ranges, which allows more than one interpretation of some colors.
The color '1 0 0' may be a near-black written for the integer range,
or red written for the floating point range.
When reading a file an integer interpretation is prefered over a
floating point interpretation. However, if all the integer color
values in the file are either 1 or 0 then they are all converted
to 0.0 and 1.0 in the floating point range.
To avoid ambiguities color values are written in the floating
point range and always with a decimal point.
Next:
Downloads
Up:
Programs and Documentation
|