简体   繁体   English

在Matlab中绘制3D云的表面

[英]Draw surface of 3D cloud in matlab

I have 3D cloud of dots. 我有3D点云。 I need to plot them as a surface. 我需要将它们绘制为表面。 I tried variant with meshdrid, griddata, scatteredInterpolant,trisurf-delaunay. 我尝试使用meshedrid,griddata,分散Interpolant,trisurf-delaunay的变体。 Nothing works. 什么都没有。 I know that this question was discussed a lot, but it seems I don't understand some important details. 我知道这个问题已经讨论了很多,但是似乎我不明白一些重要的细节。 The code which i have now: 我现在拥有的代码:

load('coords.mat')
figure()
subplot(1,2,1)
plot3(x,y,z,'.')
axis off
view(3)

subplot(1,2,2)
C=gray(numel(x)); % unsuccessful attempt
[~,idx]=sort(z);  %      to have 
C=C(idx,:);       %    illumination
scatter3(x,y,z,50,C,'filled')
axis off
view(3)

produces the following image: 产生以下图像: 在此处输入图片说明

Could you help me: 你可以帮帮我吗:

1) to find a way to draw it with surface function. 1)找到一种使用曲面功能绘制它的方法。

and as some dots may be inside the surface (may be it is my problem) 而且表面上可能有一些点(可能是我的问题)

2) How to remove 'invisible' dots? 2)如何去除“隐形”点?

I need solution for different cases, picture and data presents just an example. 我需要针对不同情况的解决方案,图片和数据仅作为示例。

Mat file may be downloaded here . Mat文件可以在这里下载。

PS PS

In case it is important – I obtain coordinates of this dots as a rotation of random bezier curve. 如果很重要–我获得这些点的坐标作为随机贝塞尔曲线的旋转。

UPDATE UPDATE

In case data above is too big I generate another set with smaller amount of dots: 如果上面的数据太大,我将生成另一个包含较少点的集合:

在此处输入图片说明

Coordinates are here . 坐标在这里

where do you get this data from? 您从哪里获得这些数据? It is represented as vectors but if you reshape it to matrices you can use the surf function. 它表示为矢量,但是如果将其整形为矩阵,则可以使用surf函数。 Try this code: 试试这个代码:

z=reshape(z,100,100);
y=reshape(y,100,100);
x=reshape(x,100,100);
surf(x,y,z)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM