Hey Ed,
I wanted to color your figure such that color classes correspond to the number of intersecting sets. The below code works (for any set of closed curves), however, it uses meshes which feels imprecise. Even for the 3 circle case one can see mesh artifacts. Whats the most natural way to do this? Would you generate the bounding (piecewise) curve for each region and assemble the figure that way, like a tiling?
(*recreate booleanregion(buggy). zo_list is a 0,1 list (or list of \
lists) of region indicators*)
booregion[regs_List, zo_List] := (
If [Depth[zo] == 2,
If[Total[zo] == Length[zo], out = EmptyRegion[2],
out = RegionUnion[Pick[regs, zo, 0]]];
RegionDifference[RegionIntersection[Pick[regs, zo, 1]], out],
RegionUnion[booregion[regs, #] & /@ zo]
]
)
(*generate weight k binary vectors of length n*)
class[n_Integer, k_Integer] :=
ReplacePart[ConstantArray[0, n], Thread[# -> 1]] & /@
Subsets[Range[n], {k}]
vennplot[regs_List, colors_List] := (
len = Length[regs];
Graphics@
Riffle[colors[[;; len]],
Table[booregion[regs, class[len, i]], {i, 1, len}]])
(*sp is defined in the original post*)
regs = Table[
DiscretizeGraphics[
FilledCurve@
BSplineCurve[sp.RotationMatrix[2 k Pi/5],
SplineClosed -> True]], {k, 0, 4}];
vennplot[regs, ColorData["TemperatureMap"] /@ Range[0, 1, .25]]