Plotting a surface from a set of interior 3D scatter points in MATLAB

后端 未结 2 684
情歌与酒
情歌与酒 2020-12-09 12:42

I have a large (~60,000) set of triplet data points representing x,y, and z coordinates, which are scattered throughout a Cartesian volume.

I\'m looking for a way t

2条回答
  •  借酒劲吻你
    2020-12-09 13:27

    If your surface enclosing the points can be described as a convex polyhedron (i.e. like the surface of a cube or a dodecahedron, without concave pits or jagged pointy parts), then I would start by creating a 3-D Delaunay triangulation of the points. This will fill the volume around the points with a series of tetrahedral elements with the points as their vertices, and you can then find the set of triangular faces that form the outer shell of the volume using the convexHull method of the DelaunayTri class.

    Here's an example that generates 200 random points uniformly distributed within the unit cube, creates a tetrahedral mesh for these points, then finds the 3-D convex hull for the volume:

    interiorPoints = rand(200,3);      %# Generate 200 3-D points
    DT = DelaunayTri(interiorPoints);  %# Create the tetrahedral mesh
    hullFacets = convexHull(DT);       %# Find the facets of the convex hull
    
    %# Plot the scattered points:
    subplot(2,2,1);
    scatter3(interiorPoints(:,1),interiorPoints(:,2),interiorPoints(:,3),'.');
    axis equal;
    title('Interior points');
    
    %# Plot the tetrahedral mesh:
    subplot(2,2,2);
    tetramesh(DT);
    axis equal;
    title('Tetrahedral mesh');
    
    %# Plot the 3-D convex hull:
    subplot(2,2,3);
    trisurf(hullFacets,DT.X(:,1),DT.X(:,2),DT.X(:,3),'FaceColor','c')
    axis equal;
    title('Convex hull');
    

    enter image description here

提交回复
热议问题