フィルターのクリア

How to un-bowtie this bow-tie?

2 ビュー (過去 30 日間)
Jeremy Salerno
Jeremy Salerno 2022 年 10 月 18 日
回答済み: Sai Kiran 2022 年 10 月 21 日
The below is taken from the polyshape example (specifically the bow-tie one) in the MATLAB documentation. Is there a way to turn this bowtie BACK into a simple rectangle polygon?
P = [0 0; 1 1; 1 0; 0 1; 0 0];
pgon = polyshape(P)
%Plot the polygon and compute its area.
plot(pgon)
A = area(pgon)

回答 (1 件)

Sai Kiran
Sai Kiran 2022 年 10 月 21 日
Hi,
I understand that you want to convert the existing shape into rectangle.
The polyshape syntax takes the points from matrix P and creates a shape by connecting each point in a linear fashion.
By changing the order of coordinates in matrix P, you would get a rectangle.
Below code gives the rectangle.
Hope it helps!
P = [0 0; 1 0; 1 1; 0 1; 0 0];
pgon = polyshape(P)
%Plot the polygon and compute its area.
plot(pgon)
A = area(pgon)

カテゴリ

Help Center および File ExchangeElementary Polygons についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by