我看一下这个sample,我想创建一个网格/曲面网格来填充这个距离。如何在PyVista中执行这样的操作
我所尝试的,似乎无法与Andras Deak beautiful answer搭桥:
import pyvista as pv
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import KDTree
import PVGeo
from PVGeo import interface
from PVGeo.filters import BuildSurfaceFromPoints
b = pv.read('./top.vtk') # PolyData
t = pv.read('./bottom.vtk') # PolyData
dim = (int(b.bounds[1]-b.bounds[0]), int(b.bounds[3]-b.bounds[2]), 1)
z_range = np.arange(b.bounds[4], b.bounds[5] )
bottom = BuildSurfaceFromPoints().apply(b)
top = BuildSurfaceFromPoints().apply(t)
grid_2d = top.points.reshape(dim[:-1] + (3,), order='F')[..., :-1]
不幸的是,这在网格2d上失败了
ValueError: cannot reshape array of size 1942464 into shape (30150,26750,3)
我不知道是否有一种内置的方法可以在两个曲面之间进行插值,但仅使用numpy就不难做到这一点
下面是一个使用Perlin noise在同一网格上以两种不同高度生成两张数据表的示例。答案的实际代码在后面
相关问题 更多 >
编程相关推荐