// base26 - spacial visualization of 4-letter words // (c) 2004 karsten schmidt / info-at-toxi.co.uk // // this source is heavily commented for educational purposes and // released under the creative commons license (http://creativecommons .org/licenses/by-nc-sa/1.0/) // // thanks to: // ben fry for inspiration, // glen murphy and seb cheverel for the fasttext + blur routines Vocabulary vocab; VoxelSpace surface; GUI gui; GUIElement[] bt_filters; FastText ft_default,ft_caps; Node rollOverNode; // background image BImage bg; // interface states // used to only execute parts of the main loop and if updates are need ed boolean updateView=true; boolean updateVolume=true; boolean updateRotation=false; boolean autoRotate=true; boolean helpRequested=false; boolean helpActive=false; float stepSize=1; // resolution used for rendering surf ace hull float isoValue=25; // threshold value used for surface h ull float isoExponent=1.25; // user adjustable iso value offset float minPotential=150; // minimum/standard potentials of a n ode/voxel float basePotential=200; float xRot=2.88; // current X rotation float yRot=-0.64; // current Y rotation float currXRot,currYRot; // temp X,Y rotation float autoAlpha=0; // angle used for auto-rotation float autoRotR=0.1; // impact of auto-rotation (in radian s) float centerX=240; // projection center point float centerY=396; float clickX,clickY; // mouse click position int typeMask=0x0f; // word types filter mask float snapDistance=10; // node select radius in pixels (for rollover) String[] usage; // cache for usage/help text void setup() { size(500,600); rectMode(CORNERS); // load background image bg=loadImage("bg.jpg"); // setup user interface elements GUIElement[] uiItems= new GUIElement[13]; // letter display uiItems[0]= new ImagePanel("initial",loadImage("alphabet2.gif"),22 0,0,60,60,0xd8,ADD); // icons BImage icon=loadImage("icons.gif"); uiItems[1]= new IconButton("help",icon,0,16,16,20,22,SUBSTRACT,ADD ); uiItems[2]= new IconButton("autoR",icon,1,16,16,40,22,SUBSTRACT,AD D); uiItems[3]= new IconButton("resMinus",icon,2,16,16,440,22,SUBSTRAC T,ADD); uiItems[4]= new IconButton("resPlus",icon,3,16,16,460,22,SUBSTRACT ,ADD); uiItems[5]= new IconButton("isoMinus",icon,2,16,16,380,22,SUBSTRAC T,ADD); uiItems[6]= new IconButton("isoPlus",icon,3,16,16,400,22,SUBSTRACT ,ADD); // stepper buttons uiItems[7]= new IncrementorButton("nextIni",1,0,25,300,20,310,40); uiItems[8]= new IncrementorButton("prevIni",-1,0,25,190,20,200,40) ; // filter type toggles bt_filters= new BitToggleButton[4]; bt_filters[0] = uiItems[9]= new BitToggleButton("filter0",typeMask ,0,228,570,8,8); bt_filters[1] = uiItems[10]= new BitToggleButton("filter1",typeMas k,1,240,570,8,8); bt_filters[2] = uiItems[11]= new BitToggleButton("filter2",typeMas k,2,252,570,8,8); bt_filters[3] = uiItems[12]= new BitToggleButton("filter3",typeMas k,3,264,570,8,8); // setup GUI with elements gui=new GUI(uiItems); // load fonts ft_default=new FastText("fffharmony.gif"); ft_caps=new FastText("fffleader_caps2.gif"); // initialize data set vocab=new Vocabulary("4letters.txt"); // setup 3d volume renderer surface=new VoxelSpace(26,26,26,24,24,24,17000); }