//------------------------------------------------------ // VISP --NANO-- infoVis-- October 2005 // piece of software mede for medien.KUNSTLABOR VISP installation in Graz (Austria) // by Alessandro Capozzo for Machfeld ( aka Sabine Maier & Michael Mastrototaro) // www.abstract-codex.net // www.machfeld.net // data baase and data evalutation by Markus Reisenhofer // ------------------------------------------------------- // built with processing beta .92 // review with beta .124 may 2007 // www.processing.org // nanoXML library was used to parse data // nanoxml.cyberelf.be //---------------------------------------------------------- // applet based on RELATION, an older abstract-codex work //---------------------------------------------------------- import java.lang.reflect.Array; // parsing init----------------------------------------- nanoxml.XMLElement messages = new nanoxml.XMLElement(); MessageObj [] messagesIstance; VispObj [] vispCluster; Object[] records; int prp=0; float milliToHour=1/3600000; boolean selection=true; //---------------------------------------------------- // infoVis init -------------------------------------- Structure [] list; int num=1; int countList=100; int medx,medy; boolean newTarget=true; int idNewDist; float newDistAbs,oldDistAbs; int trans; //----------------------------------------------------- int counterJump; /// PFont font; void setup(){ size(720,480,P3D); framerate(25); background(255); font = loadFont("small.vlw"); textFont(font, 8); counterJump=0; // parse Reader reader = new InputStreamReader(openStream("messages_attribs_xml.xml")); try{ messages.parseFromReader(reader); records = messages.getChildren().toArray(); initMessages(); } catch (Exception e) { e.printStackTrace(); } //---------- setupNew(); } void keyReleased(){ if (key == 'n' || key == 'N') { selection=false; setupNew(); } if (key == 'o' || key == 'O') { selection=true; setupNew(); } } void mousePressed() { newTarget=false; } void mouseReleased() { newTarget=true; trans=0; } void setupNew (){ idNewDist=0; int countDown=vispCluster.length-1; list=new Structure[countList]; boolean typeV; if(selection){ for(int index=0;index30)){ //old id+++++++++++++++++++++++++++++++++++++++ if(true){ if(!contact){ contact=true; } // colore connesioni stroke(220-distanza+velocityX,200-distanza+velocityY,170-distanza+velocityY,75-distanza); line(bx,by,list[r2].cont[ND].bx,list[r2].cont[ND].by); noStroke(); float mDist=dist(bx,by,list[r2].cont[ND].bx,list[r2].cont[ND].by); //noFill(); noFill(); } } } } } float velox=0; float veloy=0; int distC=0; for (int r3=0;r3limitV){ velocityX=limitV; } if(velocityY>limitV){ velocityY=limitV; } if(velocityX<-limitV){ velocityX=-limitV; } if(velocityY<-limitV){ velocityY=-limitV; } bx=bx+int(velocityX); by=by+int(velocityY); if(bx<30){ if(velocityX<0){ velocityX+=1; } if(bx<0){ bx+=30; } } if(by<30){ if(velocityY<0){ velocityY+=1; } if(by<0){ by+=30; } } if (bx>(width-30)){ if(velocityX>0){ velocityX-=1; } if(bx>width){ bx-=30; } } if (by>(height-30)){ if(velocityY>0){ velocityY-=1; } if(by>height){ by-=30; } } } } void distance(){ objX=cont[me-1].bx-bx; objY=cont[me-1].by-by; dist=sqrt(sq(objX)+sq(objY)); if(abs(dist)!=15){ objY+=.01; objX+=.01; double betaD=Math.atan(objY/objX); beta=(float) betaD; if(cont[me-1].by>=by){ radius=15; }else { radius=-15; } if(beta>0){ bx=cont[me-1].bx-int((radius)*cos(beta)); by=cont[me-1].by-int((radius)*sin(beta)); }else { bx=cont[me-1].bx+int((radius)*cos(beta)); by=cont[me-1].by+int((radius)*sin(beta)); } line(cont[me-1].bx,cont[me-1].by,bx,by); } } } }