Simple Isometric graphics with processing

Posted by Nikolaus Gradwohl Wed, 20 May 2009 03:08:00 GMT

I found a very simple way to generate isometric graphics in processing.

isometric

click here to see it as an applet (and get the source)

the trick is to rotate the image by 45 deg and scale it with scale(1, 0.5).

this way the graphic can be draw as always, only the z coordinate has to be substracted from the x and the y coordinate

...
void draw() {
  pushMatrix();
  translate( width/2, height/2 );
  scale( 1, 0.5 );
  rotate( radians( 45 ) );
  translate( -width/2, -height/2 );
  background(255);

  line( x1 - z1, y1 - z1, x2 - z2, y2 - z2 );   

  popMatrix();
}
...

Tags  | 1 comment | no trackbacks

Tweet This! submit to reddit Digg!

Comments

  1. mhuyck said about 11 hours later:

    Clever! Thanks for sharing...

Trackbacks

Use the following link to trackback from your own site:
http://www.local-guru.net/blog/trackbacks?article_id=simple-isometric-graphics-with-processing&day=20&month=05&year=2009

(leave url/email »)

   Comment Markup Help Preview comment