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.
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.
Unclear the kind of comparison you want to do.
Assuming you want the geometric intersection of the triangulations, an easy solution is to intersect all polygons pairwise. (If the number of triangles is large, use some acceleration technique to avoid all comparisons.)
If you need the triangulated intersection, you can use a clipping algorithm (Sutherland–Hodgman) and triangulate the resulting polygons, which can range in shape from triangles to hexagons. Fortunately, they are convex.