pyvista.PolyData.from_regular_faces#

classmethod PolyData.from_regular_faces(
points: MatrixLike[float],
faces: MatrixLike[int],
deep=False,
)[source]#

Alternate pyvista.PolyData convenience constructor from point and regular face arrays.

Parameters:
pointsMatrixLike[float]

A (n_points, 3) array of points.

facesMatrixLike[int]

A (n_faces, face_size) array of face indices. For a triangle mesh, face_size = 3.

deepbool, default: False

Whether to deep copy the faces array into vtkCellArray connectivity data.

Returns:
pyvista.PolyData

The newly constructed mesh.

Examples

Construct a tetrahedron from four triangles

>>> import pyvista as pv
>>> points = [[1.0, 1, 1], [-1, 1, -1], [1, -1, -1], [-1, -1, 1]]
>>> faces = [[0, 1, 2], [1, 3, 2], [0, 2, 3], [0, 3, 1]]
>>> tetra = pv.PolyData.from_regular_faces(points, faces)
>>> tetra.plot()
../../../_images/pyvista-PolyData-from_regular_faces-1_00_00.png