A simple algorithm for polygon intersection

Posted by Elazar Leibovich on Stack Overflow See other posts from Stack Overflow or by Elazar Leibovich
Published on 2010-02-16T10:38:43Z Indexed on 2010/06/06 11:32 UTC
Read the original article Hit count: 242

Filed under:
|
|
|

I'm looking for a very simple algorithm for computing the polygon intersection/clipping. That is, given polygons P, Q, I wish to find polygon T which is contained in P and in Q, and I wish T to be maximal among all possible polygons.

I don't mind the run time (I have a few very small polygons), I can also afford getting an approximation of the polygons' intersection (that is, a polygon with less points, but which is still contained in the polygons' intersection).

But it is really important for me that the algorithm will be simple (cheaper testing) and preferably short (less code).

edit: please note, I wish to obtain a polygon which represent the intersection. I don't need only a boolean answer to the question of whether the two polygons intersect.

© Stack Overflow or respective owner

Related posts about math

Related posts about geometry