OFF Files
Geomview Object File Format
These are some examples of OFF files. An OFF file is good
for storing a description a 2D or 3D object constructed
from polygons. There is even a simple extension which can handle
objects in 4D.
OFF File Characteristics:
-
ASCII (there is also a binary version);
-
Color optional;
-
3D;
-
No compression;
While there are many variations and extensions of the OFF format,
the simplest files have the following structure:
- Line 1
- OFF
- Line 2
- vertex_count face_count edge_count
- One line for each vertex:
- x y z
for vertex 0, 1, ..., vertex_count-1
- One line for each polygonal face:
- n v1 v2 ... vn,
the number of vertices, and the vertex indices for each face.
The vertices are implicitly numbered by the order of their listing
in the file. The first vertex will have index 0, and the last
will have index vertex_count-1. Comment lines may be inserted
anywhere, and are denoted by the character # appearing in column 1.
Blank lines are also acceptable.
Colors can be assigned to the vertices by following the XYZ coordinates
of a vertex with the RGBA color coordinates (the "A" coordinate
controls the transparency). In particular, this means that the
form of the vertex lines would be:
- One line for each colored vertex:
- x y z r g b a
for vertex 0, 1, ..., vertex_count-1
Colors can be assigned to the faces by following the vertex
indices by the RGBA color coordinates of the face. In particular,
this means that the form of the face lines would be:
- One line for each polygonal face:
- n v1 v2 ... vn r g b a,
the number of vertices, the vertex indices, and the RGBA color
coordinates for each face.
Normally, color is not specified for BOTH the vertices and faces.
If the node colors are specified, then the faces are colored
with a smooth interpolation of the colors of their vertices.
Example OFF file:
OFF
#
# cube.off
# A cube.
# There is extra RGBA color information specified for the faces.
#
8 6 12
1.632993 0.000000 1.154701
0.000000 1.632993 1.154701
-1.632993 0.000000 1.154701
0.000000 -1.632993 1.154701
1.632993 0.000000 -1.154701
0.000000 1.632993 -1.154701
-1.632993 0.000000 -1.154701
0.000000 -1.632993 -1.154701
4 0 1 2 3 1.000 0.000 0.000 0.75
4 7 4 0 3 0.300 0.400 0.000 0.75
4 4 5 1 0 0.200 0.500 0.100 0.75
4 5 6 2 1 0.100 0.600 0.200 0.75
4 3 2 6 7 0.000 0.700 0.300 0.75
4 6 5 4 7 0.000 1.000 0.000 0.75
Reference:
-
http://www.geomview.org,
the GEOMVIEW web site;
-
the GEOMVIEW Manual in PDF format
-
the OFF format
Programs to view an OFF file:
-
SG is an OpenGL display tool for finite element meshes,
which can display OFF files created by MC.
Programs to create an OFF file:
-
qvoronoi
can write an OFF file containing the description of the
2D Voronoi diagram of a set of points.
-
MC
generates a 2D triangular mesh, or 3D tetrahedral mesh,
which can be output in OFF format.
Programs to convert an OFF format to another format:
-
the FORTRAN90 program
IVREAD
can read an OFF file, and write out the information in
a variety of 3D file formats.
Programs to convert another format to OFF format:
-
the FORTRAN90 program
IVREAD
can read a variety of 3D files, and write out an equivalent OFF
file.
Sample OFF Files:
-
abstr.off;
-
br2.off;
-
cam.off;
-
cone.off;
-
cube.off, a cube;
-
dodec.off, a dodecahedron;
-
dodec2.off, another dodecahedron;
-
facecube.off, a cube with face colors;
-
hdodec.off;
-
hypercube.4d.off, a hypercube
in four dimenensions;
-
icosa.off, an icosahedron;
-
mctet.off, a tetrahedral mesh
generated by MC;
-
mctri.off, a triangular mesh
generated by MC;
-
mushroom.off;
-
octa.off, an octahedron;
-
tetra.off, a tetrahedron;
-
trapezoid.4d.off, a trapezoid in
4D;
-
tref.off;
-
unitcube.off, the unit cube;
-
vertcube.off, a cube with vertex colors;
You can go up one level to
the DATA page.
Last revised on 20 May 2004.