Looking for a way to partition an alphaShape object between its respective alphaShape sub-regions.

1 Ansicht (letzte 30 Tage)
I have an alphaShape object (shp) made of 11 distinct sub-regions (N=11).
I want to partition my alphaShape between it's 11 respective sub-regions.
I want to plot each region in a different color and compute its respective area.
x and y are the coordinates of shp.
For n=1, I compute the x-y coordinates of the sub-region (x1 & y1) , make a new alphaShape (shp1) and compute its area (area1).
I redo these steps for n=2,3,...,N.
The file data.mat attached contains the variables shp, x and y.
Here what it looks like for n=1:
Load('data.mat')
N = numRegions(shp); %# of regions in shp
%For n=1
tf1 = inShape(shp,x,y,1); %true (1) for points in region n=1
index1 = find(tf1==1); %corresponding index for region n=1
x1 = x(index1); %corresponding x-coord for region n=1
y1 = y(index1); %crresponding y-coord for region n=1
shp1 = alphaShape(x1,y1,1); %create new alphaShape object for region n=1 with alpha radius 1
area1 = area(shp1); %area for alphaShape object for region n=1
%Redo the steps for n=2,3,...,N
It works but I feel like I am doing a lot of unnecassary steps.
I am looking for a clever way to use the sub-regions of an alphShape object as distinct alphaShape objects on their own.
Thanks

Antworten (0)

Kategorien

Mehr zu Bounding Regions finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by