TPLC File Format

The .tplc file format is is used for storing the triangulation of a piecewise linear complex (PLC).  This format is used to store the entire output mesh. 

A .tplc file consists of 6 sections (5 in 2D).

1. TPLC
2. Dimension
3. Points
4. Segments
5. Faces (omitted if dimension is 2D)
6. Tetrahedra (Triangles in 2D)

Section 1. TPLC section

This section identifies the file type.

First line: TPLC

Section 2.  Dimension section

This section specifies the dimension of the PLC: either 2 or 3.

First line: DIMENSION <dim>

Section 3.  Points section

This sections contains the coordinates of all the points in the refined PLC.

First line: POINTS <# points>
Remaining lines: <point id> <x coord> <y coord> <z coord>

<point id> should be an integer.  <z coord> is omitted if <dim> is 2.

Section 4.  Segments section

This section contains the subsegments of each input segment.

First Line: SEGMENTS <# segments>
Remaining lines: <segment id> <# points> <ordered list of points>

The orientation of each segment is preserved from the input file. 

Section 5.  Faces section

This section contains the triangulation of each input face.

First Line: FACES <# faces>

Each face is then specified in the following format.

<face id> <# triangles>
<list of triangles>

Each triangle in the list is given the ides its 3 vertices.  The triangles in each face are consistently oriented in the same direction as the input data. 

Section 5.  Tetrahedra/Triangle section

In 3D, this section contains a list of tetrahedra.

First Line: TETS <# tetrahedra>
Remaining lines: <list of tetrahedra>

Each tetrahedron is given by a list of 4 point ids. 

In 2D, this section contains a list of triangles.

First Line: TRIANGLES <# triangles>
Remaining lines: <list of triangles>

Each triangle is given by a list of 3 point ids.  

Example

The example file below contains a single tet with one input face. 

TPLC
DIMENSION 3
POINTS 4
0 0 0 0
1 1 0 0
2 0 1 0
3 0 0 1
SEGMENTS 3
100 2 0 1
101 2 1 2
102 2 2 1
FACES 1
200 1
0 1 2
TETS 1
0 1 2 3