How to get intersection of very large polyshapes?
9 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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,
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
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
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 Exchange 中查找有关 Elementary Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!