I am trying to read the data from some .OFF files(Object File Format)and store them in certain data struture. They contain the description of the composing polygons of a geometric object,(From wiki) and look like this:
OFF
2903 5804 120
3.71636 2.34339 0
4.12656 0.642027 0
...
3 1955 2193 2185
3 2193 1965 2192
My understanding about the .OFF file structure is: Some header data on the very beginning. Data like ' 3.71636 2.34339 0' should be the coordinates of vertices. Data like '3 1955 2193 2185' should be 'the number of vertices of one face and the indexes of the vertices'. Is it correct?
I found some methods to read data with C++. But I didn't find a way to read different types of data in one file. Is there a good way to read different data from one file?
Is there a way to read the data row by row?
How can I calculate the normals based on the data in such .OFF file?