在 MATLAB 中从一组内部 3D 散点绘制表面 [英] Plotting a surface from a set of interior 3D scatter points in MATLAB

查看:41
本文介绍了在 MATLAB 中从一组内部 3D 散点绘制表面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一大组(~60,000)三重数据点代表 x、y 和 z 坐标,它们分散在笛卡尔体积中.

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

我正在寻找一种使用 Matlab 来可视化由点的最大范围描述的非凸形状/体积的方法.

I'm looking for a way to use Matlab to visualize the non-convex shape/volume described by the maximum extent of the points.

我当然可以使用 scatter3 将各个点可视化,但是鉴于点的数量很多,形状的细节会被点的噪声所掩盖.

I can of course visualize the individual points using scatter3, but given the large number of points the details of the shape are obscured by the noise of the dots.

打个比方,假设您将大小随机的球体(例如 BB、乒乓球和 kix)填充到沙漏中,然后获得每个对象的中心坐标.您将如何获取这些坐标并将包含它们的沙漏的形状可视化?

As an analogy, imagine that you filled a hour glass with spheres of random sizes such as BBs, ping pong balls, and kix and then were given the coordinates of the center of each of each object. How would you take those coordinates and visualize the shape of the hour glass containing them?

我的示例使用不同大小的对象,因为数据点之间的间距不均匀且有效随机;它使用沙漏,因为形状是非凸面的.

My example uses different sized objects because the spacing between data points is non-uniform and effectively random; it uses an hourglass because the shape is non-convex.

推荐答案

如果包围点的曲面可以描述为 凸多面体(即像立方体的表面或十二面体,如果没有凹坑或 锯齿状尖头部分),那么我将首先创建一个 3-D Delaunay 三角剖分 点.这将用一系列以点为顶点的四面体元素填充点周围的体积,然后您可以使用 convexHull DelaunayTri 类的方法.

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.

下面是一个示例,它在单位立方体内均匀分布地生成 200 个随机点,为这些点创建一个四面体网格,然后找到体积的 3-D 凸包:

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');

这篇关于在 MATLAB 中从一组内部 3D 散点绘制表面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆