给定凸多面体(3D)顶点的位置,我需要计算多面体的质心和体积。以下代码可在Mathworks site获得。 function C = centroid(P)
k=convhulln(P);
if length(unique(k(:)))<size(P,1)
error('Polyhedron is not convex.');
end
T = delaunayn(P);
n
假设有n三维物体(多面体)。计算所有对象O(n^2)的交集是最快的方法吗? 现在,我使用的基本上迫使T(N)等于N^2库: for each object: // there are n objects
get list of intersecting objects // this takes n steps
,从字面上需要N^2层的步骤。我可以想到的方式仍然是O(n^2),但是T