A demo for Chipmunk Pro's auto-geometry module. It works by using a sampling function, so you can make it trace an image mask, procedural noise such as perlin noise, or any other function you can think of.
For this demo I stored the terrain density in a point cloud, a list of fuzzy dots. This uses very little memory and doesn't have any bounds. While you can't scroll in this demo, if the same technique was used in a game you could keep digging in any direction and never hit any limits or edges.
The demo also breaks the terrain up into tiles. Whenever a chunk is taken out of the terrain, it only updates the tiles that it overlaps. This allows it to run very fast, requiring only 0.2 milliseconds on a Core 2 Duo machine for each chunk of terrain removed.