Alex Rivera | Logout

Interpolate surface of 3D cylinder in Matlab

Asked 2012-10-12T16:49:42.067
10

I have a dataset that describes a point cloud of a 3D cylinder (xx,yy,zz,C): 3D point cloud

and I would like to make a surface plot from this dataset, similar to this enter image description here

In order to do this I thought I could interpolate my scattered data using TriScatteredInterp onto a regular grid and then plot it using surf:

F = TriScatteredInterp(xx,yy,zz);
max_x = max(xx); min_x = min(xx);
max_y = max(yy); min_y = min(yy);
max_z = max(zz); min_z = min(zz);
xi = min_x:abs(stepSize):max_x;
yi = min_y:abs(stepSize):max_y;
zi = min_z:abs(stepSize):max_z;
[qx,qy] = meshgrid(xi,yi);
qz = F(qx,qy);
F = TriScatteredInterp(xx,yy,C);
qc = F(qx,qy);

figure
surf(qx,qy,qz,qc);
axis image

This works really well for convex and concave objects but ends in this for the cylinder: enter image description here

Can anybody help me as to how to achieve a nicer plot?

Edit
Report

1 Answer

1

Have you tried Delaunay triangulation?

http://www.mathworks.com/help/matlab/ref/delaunay.html

load seamount
tri = delaunay(x,y);
trisurf(tri,x,y,z);

plot

There is also TriScatteredInterp

http://www.mathworks.com/help/matlab/ref/triscatteredinterp.html

ti = -2:.25:2;
[qx,qy] = meshgrid(ti,ti);
qz = F(qx,qy);
mesh(qx,qy,qz);
hold on;
plot3(x,y,z,'o');

enter image description here

answered 2012-12-07T20:46:00.240

Your Answer