주요 콘텐츠

holes

R2026b

polyshape 구멍 경계를 polyshape 객체로 구성된 배열로 변환

설명

polyout = holes(polyin)은 polyshape 객체의 구멍 경계를 polyshape 객체로 구성된 배열로 반환합니다. polyout 내 요소 개수는 polyin의 구멍 경계 수와 동일합니다.

예제

예제

모두 축소

2개의 채워진 영역과 2개의 구멍을 포함하는 다각형을 만듭니다. 구멍 경계를 polyshape 객체로 구성된 배열로 변환합니다.

P = [0 0; 0 2; 2 2; 2 0; NaN NaN; 0.5 0.5; 0.5 1.5; 1.5 1.5; 1.5 0.5; ...
    NaN NaN; 3 0.5; 3.5 1.5; 4 0.5; NaN NaN; 3.25 0.6; 3.75 0.6; 3.5 1];
polyin = polyshape(P);
plot(polyin)
xlim([-0.5 4.5])
ylim([-0.5 2.5])

Polygon with two solid regions, a square with a square hole and a triangle with a triangular hole

polyout = holes(polyin)
polyout = 
  2×1 polyshape array with properties:

    Vertices
    NumRegions
    NumHoles

plot(polyout)
xlim([-0.5 4.5])
ylim([-0.5 2.5])

Two polyshape objects representing the extracted hole boundaries, a square and a small triangle

입력 인수

모두 축소

입력 polyshape로, 스칼라로 지정됩니다.

데이터형: polyshape

버전 내역

R2017b에 개발됨

참고 항목

| | |