pyvista.PolyDataFilters.decimate

pyvista.PolyDataFilters.decimate#

PolyDataFilters.decimate(
target_reduction,
volume_preservation: bool = False,
attribute_error: bool | None = None,
scalars: bool | None = None,
vectors: bool | None = None,
normals: bool | None = None,
tcoords: bool | None = None,
tensors: bool | None = None,
scalars_weight=0.1,
vectors_weight=0.1,
normals_weight=0.1,
tcoords_weight=0.1,
tensors_weight=0.1,
inplace: bool = False,
progress_bar: bool = False,
boundary_constraints: bool = False,
boundary_weight: float = 1.0,
enable_all_attribute_error: bool = False,
)[ソース]#

vtkQuadricDecimation を使用して,3角形メッシュ内の3角形の数を減らします.

バージョン 0.45 で変更: scalars, vectors, normals, tcoords and tensors are now disabled by default. They can be enabled all together using enable_all_attribute_error.

パラメータ:
target_reductionfloat

削除する元のメッシュの割合.もし target_reduction が 0.9 に設定されていると,このフィルタはデータセットを元のサイズの10%に縮小しようとし,入力3角形の90%を削除します.

volume_preservationbool, default: False

3角形の法線方向のエラーを大幅に減らすボリューム保存を有効にするかどうかを決定します. False の場合,ボリュームの保存は無効になり, attribute_error がアクティブな場合,これらのエラーは大きくなる可能性があります.

attribute_errorbool, default: False

データの属性をエラーメトリクスに含めるかどうかを決定します. False であれば,幾何学的な誤差のみを用いてデシメーションを制御する. True の場合には,以下のフラグを使って,どの属性を誤差計算に含めるかを指定します.

バージョン 0.45.0 で非推奨.

scalarsbool, default: False

This flags control specifically if the scalar attributes are to be included in the error calculation.

vectorsbool, default: False

scalars パラメータを参照してください.

normalsbool, default: False

See scalars parameter. .. versionchanged:: 0.45.0

tcoordsbool, default: False

scalars パラメータを参照してください.

tensorsbool, default: False

scalars パラメータを参照してください.

scalars_weightfloat, default: 0.1

スカラーアトリビュートのスケーリングウェイトの影響.これらの値は,エラーメトリックに対する属性の影響を重み付けするために使用されます.

vectors_weightfloat, default: 0.1

scalars_weight パラメータを参照してください.

normals_weightfloat, default: 0.1

scalars_weight パラメータを参照してください.

tcoords_weightfloat, default: 0.1

scalars_weight パラメータを参照してください.

tensors_weightfloat, default: 0.1

scalars_weight パラメータを参照してください.

inplacebool, default: False

インプレースでメッシュを更新するかどうか.

progress_barbool, default: False

進行状況を示す進行状況バーを表示します.

boundary_constraints: bool, default: False

Use the legacy weighting by boundary_edge_length instead of by boundary_edge_length^2 for backwards compatibility. It requires vtk>=9.3.0.

Added in version 0.45.0.

boundary_weight: float, default: 1.0

A floating point factor to weigh the boundary quadric constraints by: higher factors further constrain the boundary. It requires vtk>=9.3.0.

Added in version 0.45.0.

enable_all_attribute_error: bool, default: False

This flag control the default value of all attribute metrics to eventually include them in the error calculation

Added in version 0.45.0.

戻り値:
pyvista.PolyData

間引済みメッシュ

参考

decimate_pro

Another option for triangular meshes.

decimate_polyline

For use with polylines.

備考

セグメンテーションフォルトまたはその他のエラーが発生した場合は,このフィルタを使用する前に pyvista.PolyDataFilters.clean() を使用して無効なセルを削除することを検討してください.

球体をデシメーションします. まず,球体をプロットします.

>>> import pyvista as pv
>>> sphere = pv.Sphere(phi_resolution=60, theta_resolution=60)
>>> sphere.plot(show_edges=True, line_width=2)
../../../_images/pyvista-PolyDataFilters-decimate-1_00_00.png

それを75%に減らしてプロットします.

>>> decimated = sphere.decimate(0.75)
>>> decimated.plot(show_edges=True, line_width=2)
../../../_images/pyvista-PolyDataFilters-decimate-1_01_00.png

Decimate taking scalars attributes into account:

>>> decimated = sphere.decimate(0.5, scalars=True)

Decimate taking all attributes except normals into account:

>>> decimated = sphere.decimate(
...     0.5, enable_all_attribute_error=True, normals=False
... )

このフィルターを使用したその他の例については, 間引き を参照してください.