how to solve polygon subtract problem?

조회 수: 6 (최근 30일)
Sierra
Sierra 2022년 10월 17일
편집: Matt J 2022년 10월 17일
I subtracted green circle from blue circle. and it returned second polygog like a moon.
but what i want to plot is thrid polygon.
how to subtract polygon liks this?
Thanks

채택된 답변

Matt J
Matt J 2022년 10월 17일
편집: Matt J 2022년 10월 17일
but what i want to plot is thrid polygon.
Plot the original polygon overlaid on top of the crescent (moon), but make the original polygon transparent.
p1=nsidedpoly(1000);
p2=nsidedpoly(1000,'Center',[1,0]);
p3=subtract(p1,p2);
plot(p3); hold on
plot(p1,'FaceAlpha',0)

추가 답변 (1개)

Matt J
Matt J 2022년 10월 17일
편집: Matt J 2022년 10월 17일
Express the 2 regions as a polyshape vector:
p1=nsidedpoly(1000);
p2=nsidedpoly(1000,'Center',[1,0]);
p3=subtract(p1,p2);
p4=intersect(p1,p2);
pFinal=[p3,p4];
h=plot(pFinal);
h(2).FaceColor='none';

카테고리

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