Drag the polygon nodes to change the shape. Click the buttons to change the operation:

Intersections:

Left White: Red Enters Blue Right White: Blue Enters Red

Left Black: Red Exits Blue Right Black: Blue Exits Red

Polygon Clipping Demo using the Greiner-Hormann algorithm by @voidqk from syntheti.cc – Public Domain

Read the companion tutorial

Read the follow-up tutorial using a more robust algorithm