pyvista.PolyData.verts#
- property PolyData.verts: NumpyArray[int][ソース]#
頂点セルを返します.
- 戻り値:
numpy.ndarray
頂点セルのインデックスの配列.
例
点群ポリデータを作成し,その頂点セルを返します.
>>> import pyvista as pv >>> import numpy as np >>> rng = np.random.default_rng(seed=0) >>> points = rng.random((5, 3)) >>> pdata = pv.PolyData(points) >>> pdata.verts array([1, 0, 1, 1, 1, 2, 1, 3, 1, 4])
頂点セルを設定します. サーフェスのメッシュと追加の頂点の両方を1つのプロットにしていることに注目してください.
>>> mesh = pv.Plane(i_resolution=3, j_resolution=3) >>> mesh.verts = np.vstack( ... ( ... np.ones(mesh.n_points, dtype=np.int64), ... np.arange(mesh.n_points), ... ) ... ).T >>> mesh.plot( ... color='lightblue', ... render_points_as_spheres=True, ... point_size=60, ... )
Vertex cells can also be set to a
CellArray
. The followingverts
assignment is equivalent to the one above.>>> mesh.verts = pv.CellArray.from_regular_cells( ... np.arange(mesh.n_points).reshape((-1, 1)) ... )