I have a 2D layer/section containing the 2D polygons colored in shades of green. I have another layer containing the 2D polygons colored in shades of blue.

Two layers of 2D polygons

I intend to figure out how different are the two layers. Maybe extracting the layers differential. Can anybody provide an algorithm, library or a hint? I took a look at CGAL, but not quite sure which package to try out.

  • 1
    $\begingroup$ "how different the two layers are" - this is a very broad statement, can you be more specific. $\endgroup$
    – pmw1234
    Jan 31, 2021 at 14:47
  • $\begingroup$ @pmw1234 Thanks for the good catch. I'm going to come up with a proper function. $\endgroup$
    – Megidd
    Jan 31, 2021 at 16:03
  • 1
    $\begingroup$ Can you describe them a bit more. Is each layer just a soup of disconnected polygons? CGAL has boolean operations for sure but its not clear if that's what you want. Also describe the desired output. $\endgroup$ Feb 1, 2021 at 2:02

1 Answer 1


In CGAL, there is the Arrangement package that allows to build a topologically valid planar partition given a set of segments, and the Regularized Boolean Set-Operations that provides boolean operations between polygons.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.