How to get intersection of very large polyshapes?

조회 수: 3 (최근 30일)
Tom
Tom 2024년 10월 20일
댓글: John D'Errico 2024년 10월 20일
I have a large polygon and some small polygons, and I need to determine the area of intersection between them. Typically, my approach would involve creating polyshape objects for each polygon and using functions to calculate their intersection and area. However, the process of generating the polyshape for the larger polygon is causing my system to become unresponsive, consuming large chunks of memory likely due to the size and complexity of the shape.
Given this challenge, I’m looking for alternative methods or strategies to effectively compute the area of intersection without experiencing performance issues. Are there specific algorithms, libraries, or techniques that could help me handle this problem more efficiently? What would you recommend for managing such large polygons in the context of intersection area calculations?

채택된 답변

Shubham
Shubham 2024년 10월 20일
편집: Shubham 2024년 10월 20일
Hey Tom,
In order to compute area of intersection between polygons where one of the polygon is very large, I would suggest you the following:
1) Reduce the number of vertices as much as possible.
a) Remove duplicates using simplify
b) If you can further decrease the number of points while maintaining the overall shape,
Use Polygon Simplification. Note that this may reduce the accuracy.
2) Get the exact vertices that are inside the large polygon to effectively get the region of your interest and eventually compute its area.
3) For an intersection to happen, one point would lie inside of a polygon and another would be outside to connect the line segment. Get the vertices where one of them is inside a polygon and adjacent one is outside, draw the line segment and have it intersect with the polygon. In this way you can compute the intersection region's area.
I have tried to explain my approach in another MATLAB Answer more extensively here, which is very similar to your query.
I hope this was helpful!
  댓글 수: 4
Shubham
Shubham 2024년 10월 20일
Thanks @John D'Errico for pointing it out, I made an oversight there. I guess then a better idea would be to process the larger polygon as chunks and check for intersections with the smaller ones, considering the memory limitations.
John D'Errico
John D'Errico 2024년 10월 20일
Regardless, I think many of your ideas will be helpful. Make big problems smaller, by use of simplification if at all possible. Sadly, big problems are sometimes just ... big.

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

추가 답변 (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