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

后端 未结 2 676
情歌与酒
情歌与酒 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:14

    You could treat your data as a sample from a three-dimensional probability density, and estimate that density on a grid, e.g. via a 3d histogram, or better a 3d kernel density estimator. Then apply a threshold and extract the surface using isosurface.

    Unfortunately, hist3 included in the Statistics Toolbox is (despite its name) just a 2d histogram, and ksdensity works only with 1d data, so you would have to implement 3d versions yourself.

    0 讨论(0)
  • 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

    0 讨论(0)
提交回复
热议问题