Alan Murta’s General Polygon Clipper is the standard way of finding the intersection, union etc. of polygons.
I wrote an Ocaml interface for this many years ago for a dead project, but I’ve only just got around to packaging it up for release. You can get it here.