MATLAB Answers

0

Placing multiple rectangles layout

Asked by ali demirkaya on 9 Oct 2018
Latest activity Answered by KSSV
on 10 Oct 2018
Hi.The rectangle on the right side is added later. How should I follow an algorithm that adding this rectangle? The quadrilateral will be placed in an empty area and Multiple rectangles will be placed.

  1 Comment

jonas
on 9 Oct 2018

Sign in to comment.

Products


Release

R2016a

2 Answers

Answer by ANKUR KUMAR on 10 Oct 2018

figure
rectangle('Position',[1 1 2 4],'Curvature',0)
rectangle('Position',[5 2 4 3],'Curvature',0)
rectangle('Position',[5 6 4 3],'Curvature',[1 1])
axis([0 10 0 10])

  0 Comments

Sign in to comment.


Answer by KSSV
on 10 Oct 2018

R1 = [1 1; 6 1 ; 6 7 ; 1 7 ] ;
R2 = [7 1 ; 10 1 ;10 8 ; 7 8] ;
figure
hold on
patch(R1(:,1),R1(:,2),'w')
patch(R2(:,1),R2(:,2),'w')
If you have more coordinates/ vertices of rectangle keep adding onto the figure.

  0 Comments

Sign in to comment.