PointSetの作成

PointSetの作成#

クラス :pyvista.PointSet は,点の集合を表す具象クラスで,ジオメトリを表現するために "点" の配列を明示的に使用するデータセットのためのインターフェイスを指定します.このクラスは,点群に対するフィルタのパフォーマンスを向上させるために役立ちます.

この例では, pyvista.PointSetpyvista.DataObjectFilters.clip() フィルターを使用してクリッピングした場合のパフォーマンスの向上を示しています.

from __future__ import annotations

import time

from pyvista import examples

lidar = examples.download_lidar()

tstart = time.time()
clipped = lidar.clip(origin=(0, 0, 1.76e3), normal=(0, 0, 1))
t_elapsed = time.time() - tstart
print(f'Time to clip with a PolyData {t_elapsed:.2f} seconds.')
Time to clip with a PolyData 2.31 seconds.

切り取られたポリデータをプロットします

clipped.plot(show_scalar_bar=False)
create pointset

Show the performance improvement when using a PointSet.

注釈

For VTK 9.4.X, there is no performance improvement due to a VTK bug which was introduced into this version. See https://gitlab.kitware.com/vtk/vtk/-/issues/19649.

# pset = lidar.cast_to_pointset()

lidar_pset = lidar.cast_to_pointset()
tstart = time.time()
clipped_pset = lidar_pset.clip(origin=(0, 0, 1.76e3), normal=(0, 0, 1))
t_elapsed = time.time() - tstart
print(f'Time to clip with a PointSet {t_elapsed:.2f} seconds.')
Time to clip with a PointSet 0.34 seconds.

同じデータセットをプロットします.

注釈

PyVistaは,プロットできるようにするために,中間的なPolyDataを作成しなければならないので, pyvista.PointSet を使用してもパフォーマンスが向上することはありません.

clipped_pset.plot(show_scalar_bar=False)
create pointset

Tags: load

Total running time of the script: (0 minutes 18.863 seconds)

Sphinx-Galleryによるギャラリー