詳細な補間点

詳細な補間点#

This example uses pyvista.DataSetFilters.interpolate(). pyvista.DataSetFilters.sample() is similar, and the two methods are compared in 補間/サンプリング法の比較.

Gaussianカーネルを使用して,あるメッシュのポイント/セル配列を別のメッシュのノードに補間します.

from __future__ import annotations

import pyvista as pv
from pyvista import examples

単純なサーフェス補間#

サーフェス上にポイントの配列をリサンプルする

# Download sample data
surface = examples.download_saddle_surface()
points = examples.download_sparse_points()

p = pv.Plotter()
p.add_mesh(points, scalars='val', point_size=30.0, render_points_as_spheres=True)
p.add_mesh(surface)
p.show()
interpolate

補間を実行します

interpolated = surface.interpolate(points, radius=12.0)


p = pv.Plotter()
p.add_mesh(points, scalars='val', point_size=30.0, render_points_as_spheres=True)
p.add_mesh(interpolated, scalars='val')
p.show()
interpolate

複合補間#

この例では,3 D空間の疎なポイントをボリュームに補間します.これらのデータはサブサーフェイスの温度プローブから得られたもので,目標はサブサーフェイスの温度場の近似3 Dモデルを作成することです.

このアプローチは簡単な見積もりには適していますが,クリギングに比べると見劣りします.

# Download the sparse data
probes = examples.download_thermal_probes()

スパースデータの周囲に補間グリッドを作成する

grid = pv.ImageData()
grid.origin = (329700, 4252600, -2700)
grid.spacing = (250, 250, 50)
grid.dimensions = (60, 75, 100)
dargs = dict(cmap='coolwarm', clim=[0, 300], scalars='temperature (C)')
cpos = [
    (364280.5723737897, 4285326.164400684, 14093.431895014139),
    (337748.7217949739, 4261154.45054595, -637.1092549935128),
    (-0.29629216102673206, -0.23840196609932093, 0.9248651025279784),
]

p = pv.Plotter()
p.add_mesh(grid.outline(), color='k')
p.add_mesh(probes, render_points_as_spheres=True, **dargs)
p.show(cpos=cpos)
interpolate

補間を実行します

interp = grid.interpolate(probes, radius=15000, sharpness=10, strategy='mask_points')

結果を可視化する

vol_opac = [0, 0, 0.2, 0.2, 0.5, 0.5]

p = pv.Plotter(shape=(1, 2), window_size=[1024 * 3, 768 * 2])
p.add_volume(interp, opacity=vol_opac, **dargs)
p.add_mesh(probes, render_points_as_spheres=True, point_size=10, **dargs)
p.subplot(0, 1)
p.add_mesh(interp.contour(5), opacity=0.5, **dargs)
p.add_mesh(probes, render_points_as_spheres=True, point_size=10, **dargs)
p.link_views()
p.show(cpos=cpos)
interpolate

Tags: filter

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

Sphinx-Galleryによるギャラリー