空间算法与数据结构 (scipy.spatial
)#
空间变换#
这些包含在 scipy.spatial.transform
子模块中。
最近邻查询#
距离度量#
距离度量包含在 scipy.spatial.distance
子模块中。
Delaunay 三角剖分、凸包和 Voronoi 图#
|
N 维 Delaunay 细分。 |
|
N 维凸包。 |
|
N 维 Voronoi 图。 |
|
球面上的 Voronoi 图。 |
|
N 维半空间交集。 |
绘图辅助函数#
|
绘制给定 2D Delaunay 三角剖分 |
|
绘制给定 2D 凸包图 |
|
绘制给定 2D Voronoi 图 |
另请参见
单形表示#
在 Delaunay 细分(N 维单形)、凸包面和 Voronoi 脊(N-1 维单形)中出现的单形(三角形、四面体等)按以下方案表示
tess = Delaunay(points)
hull = ConvexHull(points)
voro = Voronoi(points)
# coordinates of the jth vertex of the ith simplex
tess.points[tess.simplices[i, j], :] # tessellation element
hull.points[hull.simplices[i, j], :] # convex hull facet
voro.vertices[voro.ridge_vertices[i, j], :] # ridge between Voronoi cells
对于 Delaunay 三角剖分和凸包,单形的邻域结构满足以下条件:tess.neighbors[i,j]
是第 i 个单形的相邻单形,与第 j
个顶点相对。如果没有邻居,则为 -1。
凸包面也定义了超平面方程
(hull.equations[i,:-1] * coord).sum() + hull.equations[i,-1] == 0
Delaunay 三角剖分中类似的超平面方程对应于相应 N+1 维抛物面上的凸包面。
Delaunay 三角剖分对象提供了一种定位包含给定点的单形以及计算重心坐标的方法。
函数#
|
查找包含给定点的单形。 |
|
计算距离矩阵。 |
|
计算两个数组之间的 L**p 距离。 |
|
计算两个数组之间 L**p 距离的 p 次方。 |
|
Procrustes 分析,一种用于两个数据集的相似性测试。 |
|
几何球面线性插值。 |
在 scipy.spatial
中使用的警告/错误#
当 Qhull 遇到错误条件时引发,例如未启用解决选项时的几何简并性。 |