overall area of intersecting rectangles

2 views (last 30 days)
Hi all, I have multiple rectangles defined by the rectangle() function, as seen in picture 1. The Hight and Width of the rectangles are variables. The positions of the rectangles are affected by each other, so if if the red rectangle gets bigger, the other rectangles will shift along the x- and y- axes.
I want to calculate the overall Area, so basically as shown in picture 2, the area between the axes and the outermost rectangle boundaries.
Any help is appreciated, thanks!

Accepted Answer

Matt J
Matt J on 6 Mar 2021
Edited: Matt J on 6 Mar 2021
If you put the rectangles in the form of a polyshape vector, poly, then it is quite easy:
Area= area(union(poly));
  7 Comments
Tobias Eißler
Tobias Eißler on 6 Mar 2021
sadly not, it is not my personal version but the one at the institute im working at.
but thanks again for your help! much appreciated!

Sign in to comment.

More Answers (0)

Categories

Find more on Elementary Polygons in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!