Problem:
I have a three-dimensional point cloud each centroid of a block representing a block. For simplicity this example is just two dimensional. As illustrated in the picture I want to include blocks of interest, based on a parameter. In the case here block 1,6,5,4. In order to further process them i need to find the smallest hull around them by either using an alpha shape or a convex hull. I have the coordinates of every centroid and i know the block extension so I can find easily the edge point of the blocks by:
xdimension=5;
ydimension=5;
block1=[5 15 1];
block2=[5 10 0];
block3=[5 5 0];
block4=[10 5 1];
block5=[10 10 1];
block6=[10 15 1];
block7=[15 5 0];
block8=[15 10 0];
block9=[15 15 0];
blocks=[block1;block2;block3;block4;block5;block6;block7;block8;block9]
dimension=[xdimension/2 ydimension/2];
point1=[1 1].*dimension;
point2=[1 -1].*dimension;
point3=[-1 1].*dimension;
point4=[-1 -1].*dimension;
i=size(blocks,1);
point1=repmat(point1,i,1);
point2=repmat(point2,i,1);
point3=repmat(point3,i,1);
point4=repmat(point4,i,1);
edges1=[blocks(:,1:2)+point1, blocks(:,3)] ;
edges2=[blocks(:,1:2)+point2, blocks(:,3)];
edges3=[blocks(:,1:2)+point3, blocks(:,3)];
edges4=[blocks(:,1:2)+point4, blocks(:,3)];
edges=[edges1;edges2;edges3;edges4];
x=edges(edges(:,3)==1,1);
y=edges(edges(:,3)==1,2);
K=convhull(x,y)
scatter(edges(:,1), edges(:,2))
hold on
plot(x(K),y(K),'r-')
hold off
This produces a picture similar to the one here.
Question
How can I query the surface (or in my real problem the volume) that is included by the convex hull of block 2 and 3 ? I need the exact surface/ volume of every individual block included apart from those that I specify to be in (here with the binary indicator). Please note that this is an example and I am looking for ideas how to do this independant of the example. I would really appreciate some help, cause I a majorly stuck here and I have no idea how to tackle it.