我正在尝试使用以下方法对圆环进行三角测量scipy.spatial.Delaunay()
函数,但无法得到想要的结果。这是我的代码:
from scipy.spatial import Delaunay
NTheta = 26
NR = 8
a0 = 1.0
#define base rectangle (r,theta) = (u,v)
u=np.linspace(0, 2*np.pi, NTheta)
v=np.linspace(1*a0, 3*a0, NR)
u,v=np.meshgrid(u,v)
u=u.flatten()
v=v.flatten()
#evaluate the parameterization at the flattened u and v
x=v*np.cos(u)
y=v*np.sin(u)
#define 2D points, as input data for the Delaunay triangulation of U
points2D=np.vstack([u,v]).T
xy0 = np.vstack([x,y]).T
Tri1 = Delaunay(points2D) #triangulate the rectangle U
Tri2 = Delaunay(xy0) #triangulate the annulus
#plt.scatter(x, y)
plt.triplot(x, y, Tri1.simplices, linewidth=0.5)
plt.show()
plt.triplot(x, y, Tri2.simplices, linewidth=0.5)
plt.show()
I get the following:
The triangulation of the annulus itself clearly gives unwanted triangles. The triangulation of the base rectangle seems to give the proper result, until you realise that the annulus is not actually closed, by stretching the annulus (i.e., moving its nodes) a bit.
所以,我的问题是,如何获得能够解释非平凡拓扑的正确三角剖分?我可以从环面的三角剖分中删除单纯形吗(例如,根据键的长度)或者以某种方式将基础矩形的两端缝合在一起?有一个简单的方法可以做到这一点吗?
Answer:
我接受了下面的答案,但它并没有完全解决所提出的问题。我仍然不知道如何使用平铺周期性表面scipy.Delaunay
(即qhull
常规)。然而,使用下面定义的掩码,可以创建一个新的三角形单纯形列表,并且这应该有多种用途。然而,不能将此列表与定义在scipy.Delaunay
班级。所以,要小心!