17
Nov
04

### Crackle

Here is a technique for generating periodic cellular textures using Voronoi diagrams.
```(* runtime: 8.5 minutes *) n = 275; SeedRandom[0]; nodes = Table[Random[], {100}, {2}]; dist[p1_, p2_] := Module[{d = Map[If[# > n/2, n - #, #] &, Abs[p2 - p1]]}, d.d]; DensityPlot[Module[{dlist = Sort[Map[dist[{j, i}, #] &, nodes]]}, dlist[[2]] -dlist[[1]]], {i, 1, n}, {j, 1, n}, PlotPoints -> n, Mesh -> False, Frame -> False];```

Mathematica’s ComputationalGeometry package can also be used to generate Voronoi diagrams, Delaunay triangulation, and convex hulls. This is useful for mesh generation:
```(* runtime: 5 seconds *) << DiscreteMath`ComputationalGeometry`; SeedRandom[0]; nodes = Table[Random[], {100}, {2}]; DiagramPlot[nodes, PlotRange -> {{0, 1}, {0, 1}}]; PlanarGraphPlot[nodes]; PlanarGraphPlot[nodes, ConvexHull[nodes]];```

POV-Ray also has a built-in function for this:
```// runtime: 0.5 second camera{orthographic location <0,0,-4> look_at 0 angle 90} plane{z,0 pigment{crackle color_map{[0 rgb 0][0.5 rgb <0,1,0>][1 rgb 1]}} finish{ambient 1}}```

Link: Cellular Texture Tutorial – by Jim Scott

Advertisements

#### 0 Responses to “Crackle”

1. Leave a Comment

## Welcome !

You will find here some of my favorite hobbies and interests, especially science and art.

I hope you enjoy it!

Subscribe to the RSS feed to stay informed when I publish something new here.

I would love to hear from you! Please feel free to send me an email : bugman123-at-gmail-dot-com

• 553,072 hits
Advertisements