How to get intersection of very large polyshapes?

9 ビュー (過去 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 Center および File ExchangeElementary Polygons についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by