Polygon File Help Page
Sample polygon files
- Cone
- Cow
- Biplane
- Apple
- Skull
- X29 plane
- Bishop
- BEETHOV
- bottle
Shift+left click to save the above files
How do you read the above files?
The first line in the file is showing what kind of file format is.
There are two kinds in those examples ('c' and 'n')
      e.g. "cone.dat" is 'n' type and "cow.dat" is 'c' type
In 'n' format:
- The second line is the number of polygons in the file
- The third line is the number of vertices of the first polygon
- The fourth line is the first vertex of the first polygon (note that: there
are six values on the line, the first three values are the x, y, z values
of the vertex, and the other three values are the normal vector of the vertex.
For program#3, you don't need the normal vector)
- The fifth line is the second vertex of the first polygon
- and the rest will be just like # of vertices followed by the vertices
The following data is extracted from cone.dat:
n <- the format of this file
40 <- # of the polygons
3 <- # of vertex of the first polygon
0 1 0 -2.98023e-09 0.0442792 1.86265e-08 <- first vertex of the first polygon
0.475528 0 0.154508 0.421121 -0.278604 0.136831 <- second vertex
0.5 0 0 0.442792 -0.278604 0 <- third vertex
3 <- # of vertex of the second polygon
0 0 0 0 -1 0 <- first vertex of the second polygon
. <- Now, I think you can figure out the rest
.
.
***********************
In 'c' format,
- The second line is the number of the groups of polygons in the file
- The third line is the number of polygons in the first group
- The fourth line is the number of vertices of the first polygon
- The fifth line is the first vertex of the first polygon (note that: there
are six values on the line, the first three values are the x, y, z values
of the vertex, and the other three values are the normal vector of the vertex.
For program#3, you don't need the normal vector)
- The sixth line is the second vertex of the first polygon
- After all the polygons of the first group are shown, the
following line will be the color of the first group of polygons
- After that, it will have the number of polygons in the second group
- and the rest will be just like that.
The following is an example of the 'c' format:
c <-- the format of this file
2 <-- # of groups of polygons in this file
2 <-- # of polygons in the first group
4 <-- # of vertices of the first polygon
1 2 3 4 5 6 <-- first vertex of the polygon
. .
. .
. <-- last vertex (I use dot to represent the vertex line
4 <-- # of vertices of the second polygon
9 8 7 6 5 4 <-- first vertex of the polygon
. .
. .
. <-- last vertex (I use dot to represent the vertex line)
0.7 0.2 0.1 <-- color of the first group of the polygons
3 <-- # of polygons in the second group
3 <-- # of vertices of the first polygon in the second group
1 2 3 4 5 6 <-- first vertex of the polygon
. <-- Now, I think you can figure it out
.
.