简体   繁体   中英

Draw surface of 3D cloud in matlab

I have 3D cloud of dots. I need to plot them as a surface. I tried variant with meshdrid, griddata, scatteredInterpolant,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.

and as some dots may be inside the surface (may be it is my problem)

2) How to remove 'invisible' dots?

I need solution for different cases, picture and data presents just an example.

Mat file may be downloaded here .

PS

In case it is important – I obtain coordinates of this dots as a rotation of random bezier curve.

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. Try this code:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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