9.8 Polyhedra

Polyhedra require the following parameters, typically formatted as follows:

NumVertices<nl>
[VertexX<spc>VertexY<spc>VertexZ<nl>
[...]]
NumFaces<nl>
[VerticesInFace[<spc>VertexIndex[<spc>...]]<nl>
[...]]

where NumVertices is an integer defining the number of vertices making up the polyhedron, VertexX is a double defining a local X co-ordinate for a vertex, VertexY is a double defining a local Y co-ordinate for a vertex, VertexZ is a double defining a local Z co-ordinate for a vertex, NumFaces is an integer defining the number of faces making up the polyhedron, VertexIndex is an integer identifying the index of a previously defined point, <spc> is the space character and <nl> is the newline sequence.

Each polyhedron is constructed from a number of faces. Each face is visible from a single side only, depending upon the face's normal vector, and is made up of three or more vertices. The constituent vertices must all lie in the same plane, although ACE does not object if they are not. Furthermore, the vertices must be listed in anti-clockwise order when viewing the intended visible side of the face.

Each vertex is defined as a point made up of an X, Y and Z co-ordinate. These are defined first and are numbered from 0 through to NumVertices - 1. The number of vertex definitions must match the NumVertices parameter. When defining each face, the number of vertices in that face is defined followed by that many vertex indices.

For example, the following defines the parameters for a square polyhedron that is visible from above and below (it requires two faces to do this):

4
0.0 0.0 0.0
1.0 0.0 0.0
1.0 1.0 0.0
0.0 1.0 0.0
2
4 0 1 2 3
4 0 3 2 1

All vertex co-ordinates are relative to the polyhedron's local axes.