필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Dadhichi
Dadhichi 2016년 4월 8일
댓글: Sean de Wolski 2016년 4월 12일
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.

답변 (1개)

Sean de Wolski
Sean de Wolski 2016년 4월 8일
You can pass RegionID into alphaTriangulation. Loop over the region ids to grab the triangulations.
  댓글 수: 2
Dadhichi
Dadhichi 2016년 4월 8일
편집: Dadhichi 2016년 4월 8일
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 2016년 4월 12일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Bounding Regions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by