Polyshape: stop Connecting first and last points.

조회 수: 7 (최근 30일)
Armin Mashhadi
Armin Mashhadi 2019년 11월 12일
댓글: Adam Danz 2019년 11월 13일
Hello all, How you doin? Can you please help me with an issue?
Problem:
I have many sets of Data (Like attached one), in two vectors that are produced seperetly by another script.
Now, I need to plot them, devide them between "Closed" and "Open" , Then search between "Closed" ones to see which one is the stable one.
I used "polyshape" like it:
load('Data');
a = polyshape(Data(:,1),Data(:,2),'Simplify',true);
b =regions(a);
plot(b)
the problem is that polyshape connects first and last point automaticlly (even when simplify is off). So all regions are closed now and finding stable region encounter with wrong answers.
Do you have any idea, about disabling this feature (to leave the plot as it is), Or any alternative command that works like "polyshape" and has ability to recognize regions with their boundry points?
Thanks a lot for your time.
----------------------------------------------------------------------------------------------------
Another Example:
how to find boundries of JUST closed area of this points? (Data2.m)
ee.JPG
  댓글 수: 5
Adam Danz
Adam Danz 2019년 11월 13일
Armin Mashhadi's answer moved here as a comment.
Got it.
Adam Danz
Adam Danz 2019년 11월 13일
@ Armin Mashhadi, if you'd like to share your solution, please add it as an answer. "got it" isn't an answer.

댓글을 달려면 로그인하십시오.

답변 (1개)

Stijn Haenen
Stijn Haenen 2019년 11월 12일
Hi,
do you mean this?
load('Data');
a=polyshape(Data(:,1),Data(:,2));
b=regions(a);
area=[b(2,1).Vertices(:,1) b(2,1).Vertices(:,2)];
line=[b(3,1).Vertices(:,1) b(3,1).Vertices(:,2);b(1,1).Vertices(:,1) b(1,1).Vertices(:,2)];
shape_area=polyshape(area);
plot(regions(shape_area));
hold on
[c,d]=max(line(1:end-1,1)-line(2:end,1));
plot(line(d+1:end,1),line(d+1:end,2),'black');
plot(line(1:d-1,1),line(1:d-1,2),'black');
  댓글 수: 1
Armin Mashhadi
Armin Mashhadi 2019년 11월 12일
Hi,
I really appreciate your efford and spending time.
But no, that was not wat i meant.
The question is how to find that region2 is closed and others are not , automaticlly.
But you assumed that region2 is closed then drew using its vertices.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Elementary Polygons에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by