pyvista.PolyData.from_regular_faces#

classmethod PolyData.from_regular_faces(points: ndarray[Any, dtype[number]] | Sequence[ndarray[Any, dtype[number]] | Sequence[int | float]], faces: ndarray[Any, dtype[integer]] | Sequence[ndarray[Any, dtype[integer]] | Sequence[int]], deep=False)[source]#

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

Parameters:
pointsMatrix

A (n_points, 3) array of points.

facesIntMatrix

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)