City grid in Processing

December 14th, 2009

I’ve taken a small step towards generating a city layout in Processing, by implementing a boxing-algorithm to divide space into smaller spaces. This algorithm is actually a lot simpler than I thought it would be, and it leaves a lot of opportunity to randomize its behaviour. My code is rather ugly, but it is a recursive method that breaks out when either the width or height of the current square is below a certain value. When broken out, it fills the square. Otherwise it continues to divide the square into two.

Here is the result of a fully drawn grid:
Full grid_small

And here is one where I tried to make the grid less obvious and more organic by leaving random plots empty:
City grid layout_520

All I need to do now is make the roads curved, so that the pattern doesn’t represent a modern city grid, but rather an ancient city center.

Uncategorized | Comments | Trackback

Leave a Reply

  1.  
  2.  
  3.  
You can keep track of new comments to this post with the comments feed.

About me

My name is Marco Hokke. My blog is about the things that interest me and things I might forget if I would not blog them.

Some of my favourite things are coding, photography, beer, theater and dance, Brian Eno's ambient music, Rammstein, purple, and reading.

Archives

Blogroll

Comics

Sites

Rijksmuseum

Meta