【问题标题】:Representation of a triangulation by different data structures用不同的数据结构表示三角剖分
【发布时间】:2021-09-26 09:53:02
【问题描述】:
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import Delaunay

points = np.array([[0.2, 0], [0.1, 1.1], [0.6, 0.1], [1, 0.5], [0.6,0.9], [0.4,0.4]])
tri = Delaunay(points)

#plot
plt.triplot(points[:,0], points[:,1], tri.simplices)
plt.plot(points[:,0], points[:,1], 'o')
plt.show()

print(tri.points)
"""
[[0.2 0. ]
[0.  1.1]
[0.6 0. ]
[1.  1. ]
[0.2 0.8]
[0.4 0.4]]
"""
print(tri.simplices)
"""
[[0 5 1]
[5 4 1]
[4 5 3]
[5 2 3]
[2 5 0]]
"""

这是点数组的 delaunay 三角剖分。我有点(tri.points)和三角形(tri.simplices)数组作为输出。我需要将这些转换为半边数据结构、翼边数据结构、角表数据结构和四边数据结构以用于不同的表示,并选择哪一个存储空间更少。在 Python 中是否有用于这些转换的库,还是我应该自己编写代码?

【问题讨论】:

  • 对不起我的五分钱,但如果您考虑内存优化。也许这个库github.com/nschloe/meshio 带来了更多的想法。
  • 你能提供正式的答案吗?这样我才能接受。 @ivan-usalko

标签: python graphics scipy triangulation delaunay


【解决方案1】:

ipgraphNetworkX 浮现在脑海中。

您可能还想查看PythonGraphApi's 部分一般想法,因为这列出了相当多的库...

说实话,我自己对图形库的经验非常有限,所以你的里程可能会有所不同......

【讨论】:

    猜你喜欢
    • 2012-09-03
    • 1970-01-01
    • 2019-09-28
    • 1970-01-01
    • 1970-01-01
    • 2015-01-07
    • 1970-01-01
    • 2015-03-07
    • 1970-01-01
    相关资源
    最近更新 更多