Volume of 3-D alpha shape
Create a set of 3-D points.
[x1, y1, z1] = sphere(24); x1 = x1(:); y1 = y1(:); z1 = z1(:); x2 = x1+5; P = [x1 y1 z1; x2 y1 z1]; P = unique(P,'rows');
Create and plot an alpha shape using an alpha radius of 1.5.
shp = alphaShape(P,1.5); plot(shp)
Compute the volume of the alpha shape.
totalvol = volume(shp)
totalvol = 8.2468
Compute the volumes of each of the two regions separately.
regionvols = volume(shp, 1:numRegions(shp))
regionvols = 1×2 4.1234 4.1234