views:

11

answers:

0

Hi

I need to read in a list of polygons from a Object File Format (.off) file (in c++). The format of .off files is basically like this:

Header infomation
x y z //co-ords for each vertex
...
NVertices v1 v2 v3 ... vN //Number of vertices for each polygon,
                          //followed by each vertex's index
...

.off files allow any number of vertices per polygon, which brings me to my question. How do you know which vertices are connected to which? For eg, if the .off file read:

Header stuff
-0.500000 -0.500000 0.500000
0.500000 -0.500000 0.500000
-0.500000 0.500000 0.500000
0.500000 0.500000 0.500000
-0.500000 0.500000 -0.500000
0.500000 0.500000 -0.500000
-0.500000 -0.500000 -0.500000
0.500000 -0.500000 -0.500000
4 0 1 3 2
4 2 3 5 4
4 4 5 7 6
4 6 7 1 0
4 1 7 5 3
4 6 0 2 4

The polygons are four sided, but not all vertices are connected. If you simply connect each vertex to each other vertex, you end up with four three sided polygons instead of one four sided polygon. I was hoping vertices were listed in a way similar to cycle notation, but I can't seem to find any information on this, so I'm guessing not.

So my question is:
Is there any format that .off files use to show this connection? If not, is there any other way to determine which vertices are connected in an .off file?