How to get 3D Points of separate regions obtained from alphaShape?
6 views (last 30 days)
Show older comments
Taking example from MATLAB docs regarding alphaShape:
[x1, y1, z1] = sphere(24);
x1 = x1(:); y1 = y1(:); z1 = z1(:);
x2 = x1+5; P = [x1 y1 z1; x2 y1 z1];
% if you plot 'P' you'll see two spheres
% plot3(P(:,1),P(:,2),P(:,3),'.')
P = unique(P,'rows');
shp = alphaShape(P(:,1),P(:,2),P(:,3),1);
N = numRegions(shp)
Output:
N = 2
I am interested in finding which points of P belong to which region. In other words labeling points in P. This can be done using different clustering methods, but I would like to know if it is possible with alphaShape.
0 Comments
Answers (1)
Sean de Wolski
on 8 Apr 2016
You can pass RegionID into alphaTriangulation. Loop over the region ids to grab the triangulations.
2 Comments
Sean de Wolski
on 12 Apr 2016
That looks right to me and matches the expectations for set intersection, i.e. no points in both but all points represented:
>>intersect(idx1,idx2)
ans =
Empty matrix: 0-by-1
>> all(ismember(alphaTriangulation(shp),union(idx1,idx2)))
ans =
1 1 1 1
See Also
Categories
Find more on Bounding Regions 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!