pyvista.PolyData.faces#
- property PolyData.faces: NumpyArray[int][ソース]#
Return the polygonal faces padded connectivity array.
Like all padded VTK connectivity arrays, the array is structured as:
[n0, p0_0, p0_1, ..., p0_n, n1, p1_0, p1_1, ..., p1_n, ...]
ここで,
n0は面0の点の数,pX_Yは面XのY番目の点です.Faces can be
TRIANGLE,QUAD, orPOLYGONcells.例えば,三角形と四角形は次のように表現されます:
[3, 0, 1, 2, 4, 0, 1, 3, 4]
Where the two individual faces are
[3, 0, 1, 2]and[4, 0, 1, 3, 4].Faces can also be set by assigning a
CellArrayobject instead of an array.- 戻り値:
numpy.ndarray面のコネクティビティの配列です.
参考
n_faces_strictverts,lines,stripsPadded connectivity arrays for other
PolyDatacell types.pyvista.PolyData.regular_faces,pyvista.PolyData.irregular_facesInitialize
PolyDatafrom faces.
備考
返された配列はその場で変更することはできず,変更しようとすると
ValueErrorが発生します.ただし,面を直接設定することも可能です.例をご覧ください.
例
>>> import pyvista as pv >>> plane = pv.Plane(i_resolution=2, j_resolution=2) >>> plane.faces array([4, 0, 1, 4, 3, 4, 1, 2, 5, 4, 4, 3, 4, 7, 6, 4, 4, 5, 8, 7])
面には,面ごとの点の数を示す "padding" が含まれていることに注意してください.
>>> plane.faces.reshape(-1, 5) array([[4, 0, 1, 4, 3], [4, 1, 2, 5, 4], [4, 3, 4, 7, 6], [4, 4, 5, 8, 7]])
面を直接設定します.次の例では,1つの正方形の面を持つ単純な平面を作成し,代わりに2つの三角形を持つように変更しています.
>>> mesh = pv.Plane(i_resolution=1, j_resolution=1) >>> mesh.faces = [3, 0, 1, 2, 3, 3, 2, 1] >>> mesh.faces array([3, 0, 1, 2, 3, 3, 2, 1])