Note

Click here to download the full example code

# Triangle Strips#

This example shows how to build a simple `pyvista.PolyData`

using
triangle strips.

Triangle strips are a more efficient way of storing the connectivity of adjacent triangles.

# Build the connectivity of the strips#

The first element is the number of points in the strip next three elements is the initial triangle the rest of the points is where the strip extends to.

# Plot the triangle strips#

Plot the `PolyData`

and include the point labels using
`add_point_labels()`

so we can see how
the PolyData is constructed using triangle strips.

```
pl = pv.Plotter()
pl.add_mesh(mesh, show_edges=True)
pl.add_point_labels(mesh.points, range(mesh.n_points))
pl.camera_position = 'yx'
pl.camera.zoom(1.2)
pl.show()
```

# Convert strips to triangles#

You can convert strips to triangle faces using `triangulate`

.

```
trimesh = mesh.triangulate()
trimesh
```

We can use this new `pyvista.PolyData`

to see how VTK represents
triangle strips as individual faces.

See how the faces array is much larger (~3x more) even for this basic example even despite representing the same data.

Note

The faces array from VTK always contains padding (the number of points in
the face) for each face in the face array. This is the initial `3`

in
the following face array.

```
array([[3, 0, 1, 2],
[3, 2, 1, 3],
[3, 2, 3, 4],
[3, 4, 3, 5],
[3, 4, 5, 6],
[3, 6, 5, 7]])
```

# Convert triangles to strips#

Convert faces from a `pyvista.PolyData`

to strips using `strip()`

. Here, for demonstration purposes we convert the
triangulated mesh back to a stripped mesh.

```
restripped = trimesh.strip()
restripped
```

The output from the `strip`

filter is, as expected, identical to the
original `mesh`

.

```
restripped == mesh
```

```
True
```

**Total running time of the script:** ( 0 minutes 0.088 seconds)