Main Content

regions

polyshape の領域にアクセス

説明

polyout = regions(polyin)polyshape オブジェクトのベクトルを返します。このベクトルの要素は、入力 polyshape の固体領域です。

すべて折りたたむ

2 つの固体領域がある多角形を計算します。次に、各要素が多角形の各領域であるベクトルを作成します。

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 = regions(polyin)
polyout = 
  2x1 polyshape array with properties:

    Vertices
    NumRegions
    NumHoles

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

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

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

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

入力引数

すべて折りたたむ

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

データ型: polyshape

バージョン履歴

R2017b で導入