The following code is very slow, with Mathematica 13.2 on a Mac Silicon M2 Pro:
domains = 1500; (* Number of domains in 3D *)
randomDomains = Table[{RandomReal[], RandomReal[], RandomInteger[{1, 2}]}, {n, 1, Ndomains}];
ImageDomaines = MedianFilter[
ImageAdjust[ListDensityPlot[randomDomains,
InterpolationOrder -> 0,
Frame -> False,
ColorFunction -> "Rainbow",
PlotRangePadding -> 0,
ImageSize -> {1024, 1024}], 0],
8]
Why is it so slow? How can we speed it up, and get curved random patterns?
Here's a preview of what this code is doing:



ListContourPlot[RandomReal[1, {35, 35}], InterpolationOrder -> 1, Contours -> 1, ContourShading -> {Red, Purple}, Frame -> False]could be a starting point. – Syed Jul 27 '23 at 03:05