You are a guest. Restricted access. Read more.
Command disabled: revisions
SCaVis manual

OFF files

OFF is a data directory which contains 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:

  1. ASCII (there is also a binary version);
  2. Color optional;
  3. 3D;
  4. 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
man/visual/fileoff_description.txt · Last modified: 2013/05/31 16:11 (external edit)
CC Attribution-Share Alike 3.0 Unported
Powered by PHP Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 Valid HTML5