algorithm - Area of Intersection of Two Rotated Rectangles - Stack Overflow
A simple algorithm that will give an approximate answer is sampling.
Divide one of your rectangles up into grids of small squares. For each intersection point, check if that point is inside the other rectangle. The number of points that lie inside the other rectangle will be a fairly good approximation to the area of the overlapping region. Increasing the density of points will increase the accuracy of the calculation, at the cost of performance.
Read full article from algorithm - Area of Intersection of Two Rotated Rectangles - Stack Overflow
No comments:
Post a Comment