Monday, February 21, 2011

Virtual Cityscape

I've had the idea for awhile now of a virtual city with buildings of different shapes and sizes that are randomly generated and organically grown by some set of rules. This is my first success with this idea:

I used the code from klein blue along with the following code snippet:

getGuy[x_, h_] := {Append[graphs[[x]][[2]][[1]], 0],
Append[graphs[[x]][[2]][[2]], h]};
hh = {graphs[[#]][[1]], Cuboid[getGuy[#, Round[8*Random[] + 1]]]} & /@
Range[Length[graphs]]; Manipulate[
Graphics3D[{hh[[1 ;; q]]}, Boxed -> False], {q, 1, Length[graphs],
1}]

It seems like the possibilities are endless.