Moving a Polygon on a Polygon

4 次查看(过去 30 天)
Hello,
I created following Polygons on top of each other:
pgon = polyshape([440 0 0 440], [0 0 5.1 5.1]);
pgon2 = polyshape([18 0 0 18], [0 0 0.5 0.5]);
plot([pgon pgon2]);
Now I want that the smaller polygon moves from on side to the other and over and over again and moves up a little each time.
Is this possible. And if yes how?

采纳的回答

KSSV
KSSV 2019-8-14
pgon = polyshape([440 0 0 440], [0 0 5.1 5.1]);
path = [1:5:100 100:-5:1] ;
for i = path
pgon2 = polyshape([18 0 0 18]+i, [0 0 0.5 0.5]);
plot([pgon pgon2]);
drawnow
end

更多回答(0 个)

类别

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