Main Content

holes

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])

Figure contains an axes object. The axes object contains an object of type polygon.

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

    Vertices
    NumRegions
    NumHoles

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

Figure contains an axes object. The axes object contains 2 objects of type polygon.

入力引数

すべて折りたたむ

入力 polyshape。スカラーとして指定します。

データ型: polyshape

バージョン履歴

R2017b で導入