Surface Area from irregular 3D surface

3 views (last 30 days)
Lewis Wayne
Lewis Wayne on 29 Jul 2015
Edited: Lewis Wayne on 29 Jul 2015
I have a set of irregular 3D cartesian coordinates that make an irregular surface. I have managed to overlay a 51x49 matrix and interpolate in-between providing enough point in order to generate a surface.
var = [X,Y,Z];
t=1;
for i=1:size(var,1)
if (var(i,1)<0 && var(i,2)>0 && var(i,3)<0)
negXposYnegZ(t,:)=(var(i,:));
t=t+1;
end
end
x3 = negXposYnegZ(:,1);
y3 = negXposYnegZ(:,2);
z3 = negXposYnegZ(:,3);
[xData3, yData3, zData3] = prepareSurfaceData( x3, y3, z3 );
% Set up fittype and options.
ft = 'linearinterp';
% Fit model to data.
[fitresult3, gof] = fit( [xData3, yData3], zData3, ft, 'Normalize', 'on' );
plot(fitresult3);
h = gcf; %current figure handle
axesObjs = get(h, 'Children'); %axes handles
dataObjs = get(axesObjs, 'Children'); %handles to low-level graphics objects in axes
objTypes = get(dataObjs, 'Type'); %type of low-level graphics object
xdata3 = get(dataObjs, 'XData'); %data from low-level grahics objects
ydata3 = get(dataObjs, 'YData');
zdata3 = get(dataObjs, 'ZData');
vector6 = reshape(xdata3.',[],1);
vector7 = reshape(ydata3.',[],1);
vector8 = reshape(zdata3.',[],1);
close all;
totalvector3 = [vector6,vector7,vector8];
ans3 = totalvector3(~any(isnan(totalvector3),2),:);
ansx3 = ans3(:,1);
ansy3 = ans3(:,2);
ansz3 = ans3(:,3);if true
scatter3(ansx3,ansy3,ansz3);
generates the following result
This can be represented as a surface, generating the following result
I can't use alphaShape as it provides an area for the whole shape, not just the surface
Any body know a way to find the area of the surface plot?
Thanks in advance

Answers (0)

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!