Skip to content

Supported Input Formats

Riccardo Fellegara edited this page Jul 2, 2018 · 2 revisions

OFF File Format

original reference

Object File Format (.off) files are used to represent the geometry of a model by specifying the polygons of the model's surface. The polygons can have any number of vertices.

The .off files in the Princeton Shape Benchmark conform to the following standard. OFF files are all ASCII files beginning with the keyword OFF. The next line states the number of vertices, the number of faces, and the number of edges. The number of edges can be safely ignored.

The vertices are listed with x, y, z coordinates, written one per line. After the list of vertices, the faces are listed, with one face per line. For each face, the number of vertices is specified, followed by indices into the list of vertices. See the examples below.

Note that earlier versions of the model files had faces with -1 indices into the vertex list. That was due to an error in the conversion program and should be corrected now.

OFF numVertices numFaces numEdges x y z x y z ... numVertices like above NVertices v1 v2 v3 ... vN MVertices v1 v2 v3 ... vM ... numFaces like above

Note that vertices are numbered starting at 0 (not starting at 1), and that numEdges will always be zero.

Example

OFF
15 17 0
40 20 5
50 400 7
66 200 15
260 100 10
200 200 2
250 300 20
400 450 4
300 120 12
500 50 1
450 200 11
200 450 13
100 20 6
450 150 8
150 490 4
350 400 3
3 0 2 11
3 2 4 11
3 1 2 4
3 1 4 10
3 1 10 13
3 3 4 11
3 3 4 7
3 3 7 8
3 7 8 12
3 7 9 12
3 4 7 9
3 4 5 9
3 4 5 10
3 5 10 14
3 6 10 14
3 6 9 14
3 5 9 14

TRI File Format

This Triangle file format just supports facet type models made up of triangular polygons (3 vertices). A TRI file first has the number of vertices, and, following, the list the vertices. Then, the number of triangles, followed by the list the triangles.

Each line in the vertex section consists of one vertex made up of its coordinates (x,y,z).

Each line in the triangle section consists of three vertices given as integer indices into the vertex section. The indices start at 0.

Example

The following TRI file has 2048 vertices and 4092 triangles. The first triangle is made up of the first three vertices, namely vertex 0, 1, and 2.

2048
0.081028 0.00519925 0.352117
0.150497 0.00501925 0.347408
0.115215 0.0552622 0.35306
0.0118943 0.0562323 0.360595
0.0114065 0.107345 0.357191
  :
  :
  :
0.847981 -0.192869 0.0724376
-0.731624 -0.00203848 -0.367665
4092
0 1 2
3 4 5
6 5 7
8 7 9
  :
  :
  :
407 1281 1911
1911 1281 410

SOUP File Format

The soup file format explicitly encodes the vertices coordinates for each triangle.

Each line represents a triangle.

Here the coordinates of a vertex are separated with a comma, while two vertices of a triangle are separated by a space.

Example

0.000000,0.000000,0.000000	0.000000,1.000000,-0.010417	1.000000,0.000000,-0.020833
0.000000,1.000000,-0.010417	1.000000,0.000000,-0.020833	1.000000,1.000000,1.000000
1.000000,0.000000,-0.020833	1.000000,1.000000,1.000000	2.000000,0.000000,-0.041667
1.000000,1.000000,1.000000	2.000000,0.000000,-0.041667	2.000000,1.000000,0.447917
2.000000,0.000000,-0.041667	2.000000,1.000000,0.447917	3.000000,0.000000,-0.062500
2.000000,1.000000,0.447917	3.000000,0.000000,-0.062500	3.000000,1.000000,-0.072917
0.000000,1.000000,-0.010417	1.000000,1.000000,1.000000	0.000000,2.000000,-0.083333
1.000000,1.000000,1.000000	0.000000,2.000000,-0.083333	1.000000,2.000000,0.395833
1.000000,1.000000,1.000000	2.000000,1.000000,0.447917	1.000000,2.000000,0.395833
2.000000,1.000000,0.447917	1.000000,2.000000,0.395833	2.000000,2.000000,1.000000
2.000000,1.000000,0.447917	3.000000,1.000000,-0.072917	2.000000,2.000000,1.000000
3.000000,1.000000,-0.072917	2.000000,2.000000,1.000000	3.000000,2.000000,-0.145833
0.000000,2.000000,-0.083333	0.000000,3.000000,-0.093750	1.000000,2.000000,0.395833
0.000000,3.000000,-0.093750	1.000000,2.000000,0.395833	1.000000,3.000000,-0.114583
1.000000,2.000000,0.395833	1.000000,3.000000,-0.114583	2.000000,2.000000,1.000000
1.000000,3.000000,-0.114583	2.000000,2.000000,1.000000	2.000000,3.000000,-0.135417
2.000000,2.000000,1.000000	2.000000,3.000000,-0.135417	3.000000,2.000000,-0.145833
2.000000,3.000000,-0.135417	3.000000,2.000000,-0.145833	3.000000,3.000000,-0.156250
Clone this wiki locally