Asymptote – The vector graphics language


Have you ever tried the script-based vector graphics programming language called Asymptote? It’s SUPER high level and if you know what you are doing, you can draw anything from Klein bottles to calendars. This code generates the image above:

import three;
import solids;
size(15cm,15cm);
pen[][] blocks = {{nullpen,  nullpen, orange, orange},
                  {black,    black,   black,  nullpen},
                  {nullpen,  black,   orange, orange},
                  {nullpen,  black,   orange, nullpen}};
for(int i=0; i<blocks.length; ++i){
  for(int j=0; j<blocks[i].length; ++j){
    draw(shift((-j,0,-i)*1.1)*unitcube, blocks[i][j]);
  }
}

Download Asymptote at SourceForge, http://asymptote.sf.net.

Share Button

Leave a Reply

Your email address will not be published. Required fields are marked *


*