Advertisement
Matthen

Random Landscapes

Oct 7th, 2012
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. Clear[landscape];
  2. landscape[n_] := landscape[n] = Module[{pts},
  3. pts = GaussianFilter[
  4. Accumulate@
  5. Table[RandomReal[NormalDistribution[0, 1], n], {i, n}],
  6. Floor[n/4]] +
  7. Transpose@
  8. GaussianFilter[
  9. Accumulate@
  10. Table[RandomReal[NormalDistribution[0, 1], n], {i, n}],
  11. Floor[n/4]];
  12. pts = Flatten[
  13. Table[{(i - 1)/(n - 1), (j - 1)/(n - 1), pts[[i, j]]}, {i,
  14. n}, {j, n}], 1];
  15. Interpolation[pts]
  16. ];
  17. Manipulate[
  18. ContourPlot[
  19. Sum[(\[Alpha])^-n landscape[2^n][x, y], {n, 2, 11}], {x, 0.2,
  20. 0.8}, {y, 0.2, 0.8}, Axes -> None, PlotRange -> All,
  21. Contours -> Table[i, {i, -3, 3, 0.1}],
  22. ColorFunction -> "GreenBrownTerrain", Frame -> None]
  23. , {\[Alpha], 1.2, 2}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement