title: How to create a 3d block grid using processing language?
body: <p>I need to create a 3D block grid with varying height using processing language. </p>
  
  <p><strong>Right now I am stuck at this output:</strong>
  <a href="http://i.stack.imgur.com/oSAA6.png" rel="nofollow">3D block grid with varying height(Current Output)</a> </p>
  
  <p><em>Code for the above output:</em></p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>import peasy.*;
  import peasy.org.apache.commons.math.*;
  import peasy.org.apache.commons.math.geometry.*;
  import peasy.test.*;
  import processing.serial.*;
  
  PeasyCam cam;
  
  
  //float i1,i2,i3;
  
  
  void setup() {
    size(800, 800, P3D);
      //smooth(4);
     cam = new PeasyCam(this, 200);
    cam.setMinimumDistance(100);
    cam.setMaximumDistance(200);
  }
  
  void draw() {
      background(200);
      randomSeed(30);
  
      for(int x=-50;x&lt;=50;x+=18)
      {
         for(int y=-50;y&lt;=50;y+=18)
            {
  
                 pushMatrix();
                 translate(x,y,0);
  
                 boxT();
  
  
                 popMatrix();
            }
  
      }
    }
  
  void boxT()
  {
    fill( random(255), random(255), random(255), random(255)); 
    strokeWeight(4);
    translate(0,0,0);
     box(10,10,random(50));  
  
  }
  </code></pre>
  
  <p>Now, my desired output is these 3D blocks with varying height but a <strong>common base plane</strong> something like this:
  <a href="http://i.stack.imgur.com/RaZEn.jpg" rel="nofollow">3D block grid with varying heights(Desired Output)</a></p>
  
  <p>Thanks in advance!</p>