MATLAB: How to view scattered (non-uniform) intensity information in 3-D space in MATLAB 7.9 (R2009b)

MATLAB

I have intensity values defined at scattered (x,y,z) coordinates. The vertices lie on the surface of a 3-D object, and I would like to view the interpolated intensity values at all points on this object.

Best Answer

If the data falls on the surface of a convex 3-D object, then we can find the 3-D convex hull for these scattered data points. Using the TRISURF function, we can set the "FaceVertexCData" property to the vertex intensity values, and these intensities can be interpolated by setting the "FaceColor" property to "interp".
Here is a full example showing how you might do this given 'x', 'y', 'z', and 'v' data ('v' is the intensity at the point defined by x, y, and z). See attached file "vars.mat" to obtain this data.
load vars.mat
figure('renderer','painters')
X=[x y z];
K = convhulln(X);
trisurf(K,X(:,1),X(:,2),X(:,3),'FaceColor',...
'interp','FaceVertexCData',v,'EdgeColor','none');
colorbar
view(-15,35)
xlabel('x')
ylabel('y')
zlabel('z')