Effacer les filtres
Effacer les filtres

How to get 3D Points of separate regions obtained from alphaShape?

3 vues (au cours des 30 derniers jours)
Dadhichi
Dadhichi le 8 Avr 2016
Commenté : Sean de Wolski le 12 Avr 2016
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.

Réponses (1)

Sean de Wolski
Sean de Wolski le 8 Avr 2016
You can pass RegionID into alphaTriangulation. Loop over the region ids to grab the triangulations.
  2 commentaires
Dadhichi
Dadhichi le 8 Avr 2016
Modifié(e) : Dadhichi le 8 Avr 2016
If I understand you correct then is it the following what you are suggesting?
tri1 = alphaTriangulation(shp,1);
tri2 = alphaTriangulation(shp,2);
idx1 = unique(tri1(:));
idx2 = unique(tri2(:))
points1 = P(idx1,:);
points2 = P(idx2,:);
Is there a better way? Or could you put the content of the link in the answer. Thanks!
Sean de Wolski
Sean de Wolski le 12 Avr 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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Bounding Regions dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by