Question: United Colors of Benetton

Let a partition of a planar polygon into colored polygons be given, i.e. something similar to

  We know the coordinates of the vertices and the color of each part, e. g. in such a way:
>with(plottools): with(plots):
>display(polygon([[.12, 1.28], [3.07, 4.54], [3.41, 1.69]]), color = red, thickness = 2, view = [-1 .. 5, -1 .. 5]);
  How to write a Maple procedure which unites the polygons having a joint edge and  the same color?
For the above partition we have to obtain two green polygons, one red polygon, one yellow polygon,
 one blue polygon, and one violet polygon.

PS. The attached picture is not created by the polygonplot/polygon command.

Please Wait...