也许在计算船体之前将点投影到超平面上就可以了。
例如使用主成分分析类sklearn.decomposition.PCA
来自scikit-learn
工具包,以减少维度。
vertices = np.random.randn(9, 10)
from sklearn.decomposition import PCA
model = PCA(n_components=8).fit(vertices)
您现在可以使用以下方法从顶点到投影来回变换model.transform
and model.inverse_transform
.
proj_vertices = model.transform(vertices)
hull_kinda = ConvexHull(proj_vertices)
hull_kinda.simplices
这会输出类似这样的内容
array([[6, 4, 3, 8, 0, 7, 5, 1],
[2, 4, 3, 8, 0, 7, 5, 1],
[2, 6, 3, 8, 0, 7, 5, 1],
[2, 6, 4, 8, 0, 7, 5, 1],
[2, 6, 4, 3, 0, 7, 5, 1],
[2, 6, 4, 3, 8, 7, 5, 1],
[2, 6, 4, 3, 8, 0, 5, 1],
[2, 6, 4, 3, 8, 0, 7, 1],
[2, 6, 4, 3, 8, 0, 7, 5]], dtype=int32)
现在使用model.inverse_transform
使单纯形回到 10 维。