我在win7上正确安装并实现了MeshPy。我测试了文档提供的示例:
from meshpy.tet import MeshInfo, build
mesh_info = MeshInfo()
mesh_info.set_points([
(0,0,0), (2,0,0),
(2,2,0), (0,2,0),
(0,0,12), (2,0,12),
(2,2,12), (0,2,12) ])
mesh_info.set_facets([
[0,1,2,3], [4,5,6,7],
[0,4,5,1], [1,5,6,2],
[2,6,7,3], [3,7,4,0],
])
mesh = build(mesh_info)
print "Mesh Points:"
for i, p in enumerate(mesh.points):
print i+1, p
print "Point numbers in tetrahedra:"
for i, t in enumerate(mesh.elements):
print i+1, t
mesh.write_vtk("test.vtk")
每一件事都很好。但是当我尝试使用三角形定义一个封闭的表面时,它不会创建网格,更确切地说是python crasches。这是代码:
mesh_info = MeshInfo()
mesh_info.set_points([
(-30502.62,-23538.02,0.0),
(-30502.62,35262.39,0.0),
(24621.61,35262.39,0.0),
(24621.61,-23538.02,0.0),
(-30502.62,-23538.02,49546.25),
(24621.61,-23538.02,49546.25),
(24621.61,35262.39,49546.25),
(-30502.62,35262.39,49546.25),
])
mesh_info.set_facets([
[1,2,3], [3,4,1],
[5,6,7], [7,8,5],
[1,4,6], [6,5,1],
[4,3,7], [7,6,4],
[3,2,8], [8,7,3],
[2,1,5], [5,8,2],
])