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


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 @velipso from sean.cm – Public Domain

Read the companion tutorial

Read the follow-up tutorial using a more robust algorithm