繁体   English   中英

使矩形网格最适合3D光滑表面

[英]Best fitting rectangular mesh to a smooth 3D surface

今天,我正在努力寻找一种方法来创建最适合光滑3D曲面的矩形网格。 特别是,我在图中显示了一个地震断层模型。

这些是断层的深度轮廓。 我想找到一个最适合表面的定义尺寸(例如10x10km)的矩形网格。 它不必(也不能)精确地在表面上,只要是最接近的表面,它就可以是矩形,而不仅仅是四边形。 我有定义曲面的节点,可以轻松对其进行插值。

我欢迎您使用Python解决方案或提出开放源代码的建议。 我已经尝试过商用网格划分器(ABAQUS),但它们总是返回四边形。 我还没有弄清楚,所以任何提示都值得赞赏。

如果具有定义曲面的节点,则意味着您具有不规则的坐标网格和相应的值。 因此,您可以由此生成一个三角剖分 (最有可能用于显示这些填充轮廓的工具在屏幕后面也使用相同的三角剖分 )。

Matplotlib有两个非常有用的类,可以三角测量转换为直线网格 (矩形网格的更通用的形式): LinearTriInterpolatorCubicTriInterpolator 此matplotlib示例中使用了它们。

这些是同一示例的基本步骤,由我注释,但是值得感谢matplotlib贡献者:

import matplotlib.pyplot as plt
import matplotlib.tri as mtri
import numpy as np

# Create triangulation.
coords, earthquake_fault = get_coordinate_data() # to be filled in by you
x = coords['x']
y = coords['y']
triang = mtri.Triangulation(x, y)

# Interpolate to regularly-spaced quad grid.
z = earthquake_fault # the "height" data
xi, yi = np.meshgrid(np.linspace(x.min(), x.max() 20), np.linspace(y.min(), y.max(), 20))

interp_lin = mtri.LinearTriInterpolator(triang, z)
zi_lin = interp_lin(xi, yi)

# Plot the triangulation.
plt.subplot(121)
plt.tricontourf(triang, z)
plt.triplot(triang, 'ko-')
plt.title('Triangular grid')

# Plot linear interpolation to quad grid.
plt.subplot(122)
plt.contourf(xi, yi, zi_lin)
plt.title('Rectangular grid')

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM