필터 지우기
필터 지우기

Remove overlapping areas of 663 rectangles

조회 수: 6 (최근 30일)
Wen Fang
Wen Fang 2018년 11월 6일
댓글: Wen Fang 2018년 11월 19일
As in the first image (Figure 1), I am trying to remove the overlaps of 663 intersecting rectangles, and have the outmost lines visible. The second image (Figure 2) presents an example with two intersecting rectangle. I have attached an EXCEL file containing the coordinates of all the rectangles. I've stuck with this problem, please help me.
Figure 1
Figure 2
  댓글 수: 4
KSSV
KSSV 2018년 11월 6일
편집: KSSV 2018년 11월 6일
If you can tell what is the final purpose....there might be another simple approach rather then this.
Are you looking for something like this?
Wen Fang
Wen Fang 2018년 11월 6일
You are totally right. But I want to have the sides of the polygons visible after removing the overlaps. The following is a simple example with three intersecting rectangles.

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

채택된 답변

Bruno Luong
Bruno Luong 2018년 11월 6일
data = xlsread('Rectangle points.xlsx');
data = reshape(data,[],2,4);
data = permute(data,[2 3 1]);
n = size(data,3);
p = arrayfun(@(k) polyshape(data(1,:,k),data(2,:,k)), 1:n);
q = p(1);
for k=2:n
q = union(q,p(k));
end
plot(q)
axis equal
  댓글 수: 9
Bruno Luong
Bruno Luong 2018년 11월 19일
Sorry I do not know any built-in data structure that can store a volume in 3D by plannar faces, beside convex hul (but in your case it is not convex at all), let alone doing operation on it.
Wen Fang
Wen Fang 2018년 11월 19일
@ Bruno Luong Thank you for your reply. Seems like this is an impossible task.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by