주요 콘텐츠

numRegions

R2026b

알파 셰이프에 있는 영역 개수

설명

N = numRegions(shp)는 알파 셰이프를 구성하는 고유한 영역의 개수를 반환합니다. 알파 반지름이 Inf인 경우 알파 셰이프는 컨벡스 헐(Convex Hull)이고 영역 개수는 1입니다. 알파 반지름의 값이 작아질수록, 점 집합에 따라 셰이프가 별개의 영역으로 분할될 수 있습니다.

예제

예제

모두 축소

2차원 점 집합을 만들고 플로팅합니다.

th = (pi/12:pi/12:2*pi)';
x1 = [reshape(cos(th)*(1:5), ...
      numel(cos(th)*(1:5)),1);
      0];
y1 = [reshape(sin(th)*(1:5), ...
      numel(sin(th)*(1:5)),1);
      0];
x = [x1;x1+15;];
y = [y1;y1];
plot(x,y,".")
axis equal

Scatter plot of two circular point sets arranged in concentric rings, one centered near the origin and one centered near x=15

알파 반지름 7을 사용하여 알파 셰이프를 만들고 여기에 있는 고유 영역의 개수를 쿼리합니다.

shp = alphaShape(x,y,7);
nregions = numRegions(shp)
nregions = 
1

더 작은 알파 반지름 2.5를 사용하면 경계를 더 잘 캡처한 다음 고유 영역의 개수를 새로 가져올 수 있습니다.

shp.Alpha = 2.5;
nregions = numRegions(shp)
nregions = 
2

알파 셰이프를 플로팅하여 경계 상태를 확인합니다.

plot(shp)

Alpha shape with two filled circular regions computed with alpha radius 2.5, one centered near the origin and one centered near x=15

입력 인수

모두 축소

알파 셰이프로, alphaShape 객체로 지정됩니다. 자세한 내용은 alphaShape를 참조하십시오.

예: shp = alphaShape(x,y)는 (x,y) 점 좌표에서 2차원 alphaShape 객체를 만듭니다.

버전 내역

R2014b에 개발됨

참고 항목