# VEF - Vertex - Edge - Face format

Written by Paul Bourke
January 1999

The Vertex-Edge-Face format isn't a formal file format but is used by many people to describe single geometric objects. The files are generally easy to create by hand or automatically, they are easy to read in software, and they contain the essence of the geometry of the object.

The file consists of 3 parts
• A list of the vertices making up the object as an (x,y,z) triple

• A list of the edges in the object referenced by a pair of vertex numbers

• A list of the faces (polygons) making up the object referenced by a number of vertex numbers

For each of these parts there is a count at the beginning of the part indicating the number of items in that part. ie: the number of vertices precedes the vertices themselves, the number of edges and faces precede their respective data. Generally, line breaks separate each item. So there is one vertex per line, one edge per line, and one face per line. The parts of a line are separated by any white space character, usually a space or tab.

There are some variations that are often found
• The vertices can be numbered from 1 instead of from 0.

• Sometimes the vertices have a label, normally as the first item on the line for each vertex.

• The vertices can have more than 3 coordinates for higher dimensional objects.

• Comments are sometimes supported, normally anything from a "#" to the end of the line is considered to be a comment.

• The edge list can be missing, indeed it can always be reconstructed from the face list.

• The face list can be in terms of the edge numbers instead of the vertex numbers.

• It is often necessary for the faces to be specified in a particular order, for example, clockwise when looking "out" of the object.

• For higher dimensional geometric forms there can be other parts which list the hyperfaces say.

Example
A unit cube with it's left-bottom corner at the origin might be described as follows:

```8                # Number of vertices
0 0 0            # x y z
1 0 0
1 0 1
0 0 1
0 1 0
1 1 0
1 1 1
0 1 1
12               # Number of edges
0 1              # Bottom edges
1 2
2 3
3 0
4 5              # Top edges
5 6
6 7
7 4
0 4              # Middle edges
1 5
2 6
3 7
6                # Number of faces
4 0 1 2 3        # Bottom
4 4 5 6 7        # Top
4 0 1 5 4        # Front
4 3 2 6 7        # Back
4 0 3 7 4        # Left
4 1 2 6 5        # Right
```

It was created by hand from the sketch below