代码之家  ›  专栏  ›  技术社区  ›  Mikhail

将Delaunay Trinagulation转换为卷

  •  0
  • Mikhail  · 技术社区  · 6 年前

    我可以通过delaunay三角剖分得到一个很好的体积表示。

    如何从三角剖分到三维网格?

    我在想,也许可以测试一堆查询点,找出它们是否位于三角形/四面体中,但我想不出最好的方法:

    clc; clear all;
    % Build a cube, in my target application this going to be from a point cloud
    d = [-1 1];
    [x,y,z] = meshgrid(d,d,d); % a cube
    x = [x(:);0];
    y = [y(:);0];
    z = [z(:);0];
    DT = delaunayTriangulation(x,y,z);
    V=ones(size(x),'like',x);
    %Build a volume from these points?
    n=5;samples=linspace(-2,2);
    [xq,yq,zq]=meshgrid(samples,samples,samples);
    pq=[xq(:),yq(:),zq(:)];
    vi = nearestNeighbor(DT,pq);
    res=reshape(vi,size(xq));
    %As expected, edges are messed up, not a cube...
    imagesc(res(:,:,round(end/2)));
    % %tetramesh(DT);
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   Mikhail    6 年前

    我想我知道了:

    vi = nearestNeighbor(DT,pq);
    

    vi = pointLocation(DT,pq);
    

    当点未封闭时,返回nan:

    不管怎么说,暂时不讨论这个问题,因为我不确定我的解决方案是否最佳。