【问题标题】:MATLAB: Calculate volume of concave polyhedron from set of scattered 3D pointsMATLAB:从一组分散的 3D 点计算凹多面体的体积
【发布时间】:2014-10-18 16:48:53
【问题描述】:

我有 20 到 30 个随机生成的 3D 点作为定义多面体的顶点。我曾尝试使用DelaunayTri(points) 枚举面并使用叉积的行列式来计算和求和四面体体积,但我不确定它是否适用于非凸面的多面体。

另一种可能的方法是将凹多面体划分为凸多面体(通过检测凸包内的点),但我无法找到这种不相交划分的算法。

另外,如何绘制这样一个凹壳?

【问题讨论】:

    标签: matlab computational-geometry polyhedra non-convex concave-hull


    【解决方案1】:

    感谢来自MATLAB Answers™Mike Garrity

    alphaShape 类似于convhull,但更通用。它将创建非凸形状。

    示例点云:

    npts = 75;
    pts = randn(npts,3);
    scatter3(pts(:,1),pts(:,2),pts(:,3),'filled')
    

    shp = alphaShape(pts);
    h = plot(shp);
    

    Alpha 形状图:

    alpha 形状的体积:

    volume(shp)
    
    ans =
        27.3914
    

    表示形状内其他点的另一种方法(绿色):

    testpts = randn(150,3);
    inmask = inShape(shp,testpts);
    h.FaceColor = [.75 .75 .75];
    h.FaceAlpha = .25;
    hold on
    scatter3(testpts(inmask,1),testpts(inmask,2),testpts(inmask,3),'.','MarkerEdgeColor','green')
    scatter3(testpts(~inmask,1),testpts(~inmask,2),testpts(~inmask,3),'.','MarkerEdgeColor','red')
    

    【讨论】:

    • 你知道有什么方法可以计算 n 维数据吗?
    • @JohnD 恐怕我不是,但如果convhulln 不够用,this excerpt 可能有一些你可以使用的东西。祝您好运,如果您的努力成功,请随时在此处留下更新。
    猜你喜欢
    • 2013-06-12
    • 2012-09-07
    • 2015-06-15
    • 2016-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多