pyvista.PolyData.from_irregular_faces

pyvista.PolyData.from_irregular_faces#

classmethod PolyData.from_irregular_faces(
points: MatrixLike[float],
faces: Sequence[VectorLike[int]],
)[source]#

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

Parameters:
pointsMatrix

A (n_points, 3) array of points.

facesSequence[VectorLike[int]]

A sequence of face vectors containing point indices.

Returns:
pyvista.PolyData

The newly constructed mesh.

Examples

Construct a pyramid from five points and five faces

>>> import pyvista as pv
>>> points = [
...     (1, 1, 0),
...     (-1, 1, 0),
...     (-1, -1, 0),
...     (1, -1, 0),
...     (0, 0, 1.61),
... ]
>>> faces = [
...     (0, 1, 2, 3),
...     (0, 3, 4),
...     (0, 4, 1),
...     (3, 2, 4),
...     (2, 1, 4),
... ]
>>> pyramid = pv.PolyData.from_irregular_faces(points, faces)
>>> pyramid.plot()
../../../_images/pyvista-PolyData-from_irregular_faces-1_00_00.png