Skip to content

toanqng/martinez-rueda

Repository files navigation

Martinez-Rueda polygon boolean operations algorithm

PHP implementation of original algorithm http://www4.ujaen.es/~fmartin/bool_op.html

Algorithm is used for computing Boolean operations on polygons:

  • union
  • difference
  • intersection
  • xor

Usage

Input parameter is a multipolygon - an array of polygons. And each polygon is an array of points x,y.

   TODO

Some visual examples

Let's consider two polygons: green multipolygon of two polygons and yellow polygon.

Snow-white polygon is result of Boolean operation on two polygons.

Union

Difference (green NOT yellow)

Intersection

Xor