凸多角形の外周を一定距離で囲む凸多角形

10 views (last 30 days)
YA
YA on 19 Oct 2022
Commented: YA on 20 Oct 2022
MATLABに関する質問です。
任意の凸多角形の各辺から平行に一定距離wで囲む凸多角形の各頂点の座標を求めたいです。
元の任意の凸多角形の頂点の座標は既知です。
物理的な意味合いとしては、凸多角形の外周に一定距離の安全マージンを設けた少し大き目の凸多角形を作るということです。
できるだけ計算負荷の少ない求め方が希望です。
ご意見やアドバイスをお持ちでしたらよろしくお願いいたします。

Accepted Answer

Atsushi Ueno
Atsushi Ueno on 19 Oct 2022
polybuffer関数を使います。
なお事前にpolyshape関数でpolyshape オブジェクトを作成する必要があります。
% 元の任意の凸多角形の頂点の座標(既知)から polyshape オブジェクトを作成
polyin = polyshape([1 2 2 3 3 4 4],[1 3 4 4 2 2 1]);
% 凸多角形の外周を一定距離で囲む凸多角形の各頂点の座標を求める
polyout1 = polybuffer(polyin,0.5,'JointType','miter');
% 求めた凸多角形の各頂点の座標
polyout1.Vertices
ans = 7×2
4.5000 0.5000 0.1910 0.5000 1.5000 3.1180 1.5000 4.5000 3.5000 4.5000 3.5000 2.5000 4.5000 2.5000
plot(polyin);
hold on
plot(polyout1);
hold off
  1 Comment
YA
YA on 20 Oct 2022
ご回答ありがとうございます。
polybuffer関数というものがあったのですね。
非常に参考になりました。 ありがとうございました。

Sign in to comment.

More Answers (0)

Categories

Find more on 基本的な多角形 in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!