int count = 0; String[] Tag = new String[14]; String Tag(String Prfx, String Sufx) { Tag[ 0]=Prfx+" o " +Sufx; Tag[ 1]=Prfx+" oooo oooo oo oo " +Sufx; Tag[ 2]=Prfx+" ooooooo oooo ooooooo oo oo " +Sufx; Tag[ 3]=Prfx+" oo oooo ooooooo oooo ooo ooooo " +Sufx; Tag[ 4]=Prfx+" oo oooooo ooooooo oo oooo " +Sufx; Tag[ 5]=Prfx+" ooo ooooo oooooo ooo ooooo " +Sufx; Tag[ 6]=Prfx+" ooooooooooo ooooooooooo oo oooo " +Sufx; Tag[ 7]=Prfx+" oooooo oooooooo oooo o oo oo " +Sufx; Tag[ 8]=Prfx+" ooo oooo " +Sufx; Tag[ 9]=Prfx+" --( Guillaume ooo LaBelle )-- goo.x@gmx.ch " +Sufx; Tag[10]=Prfx+" oo oo " +Sufx; Tag[11]=Prfx+" ooo ooo " +Sufx; Tag[12]=Prfx+" oooooooo " +Sufx; Tag[13]=Prfx+" oooo " +Sufx; return join(Tag,"\n"); } BFont LogicFont; void setup() { size(500, 550); initSlider(); initButtons(); //noStroke(); smooth(); ellipseMode(CENTER_DIAMETER); LogicFont = loadFont("SlideFont.vlw"); //Init(); //pyramid(); //cube(); //building00a(); //dome(10, 5, tempMem); //motsBase(); //curvedLines(12); //knot(); initScale(); } int Background = 255; void loop() { background(Background); updateSlider(); //ForLoop updateButtons(); push(); //updateProjective(); updateOrbit(); Cub(); //Draw(); //DON'T REMOVE pop(); } //------------------------------------------------------------ //------------------------------------------------------------ //--( VUES )-- //------------------------------------------------------------ float xmag, ymag = 0; float newXmag, newYmag = 0; void updateOrbit(){ translate(width/2, width/2, -30); if(key=='1') { newXmag = mouseX/float(width) * TWO_PI; newYmag = mouseY/float(height) * TWO_PI; key='a'; } float diff = xmag-newXmag; if (abs(diff) > 0.01) { xmag -= diff/4.0; } diff = ymag-newYmag; if (abs(diff) > 0.01) { ymag -= diff/4.0; } rotateX(-ymag); rotateY(-xmag); if(key=='2') { scScene*=0.875+(mouseY/float(height))/4; key='a'; } scale(100*scScene); } void updateProjective(){ translate(width/2, height/2); scale(100*scScene); } float scNode, scLine, scAngle, scLabel, scScene, rndMoov; //Scales void initScale(){ scNode = 1; scLine = 1; scAngle = 3; scLabel = 0.75; scScene = 0.0075; rndMoov = 0.01; } int rR = 2; int rRt = 100; //------------------------------------------------------------ //------------------------------------------------------------ //--( DIVERS )-- //------------------------------------------------------------ float rRnd(float rR, float rRt){ float rRnd = random(rR)/rRt-(rR/rRt)/2; return rRnd; }; int r(int max){ return int(random(max)); } //------------------------------------------------------------ //------------------------------------------------------------ //--( Sliders )-- //------------------------------------------------------------ /*Global*/ BFont slideFont; HScrollbar[] GooSlider = new HScrollbar[7]; /////////////////////////////// //Sliders fn /////////////////////////////// void initSlider(){ slideFont = loadFont("SlideFont.vlw"); int co = 150; GooSlider[0] = new HScrollbar(10/*xPos*/, height-10*1/*yPos*/,width-100/*width*/,8/*height*/,05/*friction*/,5/*init*/,0/*MIN*/,10/*MAX*/, "AFF", color(co,co,co) ); GooSlider[1] = new HScrollbar(10/*xPos*/, height-10*2/*yPos*/,width-100/*width*/,8/*height*/,05/*friction*/,5/*init*/,0/*MIN*/,10/*MAX*/, "ATT", color(co,co,co) ); GooSlider[2] = new HScrollbar(10/*xPos*/, height-10*1/*yPos*/,width-100/*width*/,8/*height*/,05/*friction*/,170/*init*/,0.1/*MIN*/,250/*MAX*/, "cLen", color(co,co,co) ); GooSlider[3] = new HScrollbar(10/*xPos*/, height-10*2/*yPos*/,width-100/*width*/,8/*height*/,05/*friction*/,15/*init*/,0.1/*MIN*/,30/*MAX*/, "cLar", color(co,co,co) ); GooSlider[4] = new HScrollbar(10/*xPos*/, height-10*3/*yPos*/,width-100/*width*/,8/*height*/,05/*friction*/,10/*init*/,0.1/*MIN*/,20/*MAX*/, "bum", color(co,co,co) ); GooSlider[5] = new HScrollbar(10/*xPos*/, height-10*4/*yPos*/,width-100/*width*/,8/*height*/,05/*friction*/,PI/4/*init*/,0.0/*MIN*/,PI/2/*MAX*/, "ROT", color(co,co,co) ); GooSlider[6] = new HScrollbar(10/*xPos*/, height-10*5/*yPos*/,width-100/*width*/,8/*height*/,05/*friction*/,7/*init*/,0/*MIN*/,20/*MAX*/, "NUM", color(co/2,co/2,co/2) ); //GooSlider[5] = new HScrollbar(10/*xPos*/, height-10*6/*yPos*/,width-100/*width*/,8/*height*/,05/*friction*/,21/*init*/,0/*MIN*/,40/*MAX*/, "GRV", color(co,co/2,0) ); //GooSlider[2] = new HScrollbar(10/*xPos*/, height-10*3/*yPos*/,width-100/*width*/,8/*height*/,35/*friction*/,0.5/*init*/,0/*MIN*/,1/*MAX*/, "PHY", color(co,co,co) ); } void updateSlider(){ for(int i=2;i 1) { spos = spos + (newspos-spos)/loose; } } int constrain(int val, int minv, int maxv) { return min(max(val, minv), maxv); } boolean over() { if(mouseX > xPos && mouseX < xPos+swidth && mouseY > yPos && mouseY < yPos+sheight) { return true; } else { return false; } } void draw() { fill(red(couleur), green(couleur), blue(couleur), 150); stroke(red(couleur), green(couleur), blue(couleur) ); line(xPos, yPos+sheight/2, xPos+swidth, yPos+sheight/2); rect(spos, yPos, sheight, sheight); fill(red(couleur), green(couleur), blue(couleur), 30); noStroke(); rect(xPos, yPos+sheight/4, swidth, sheight/2); fill(red(couleur), green(couleur), blue(couleur)); value = getPos(); textFont(slideFont, 18); text( " "+name+" "+nf(value, 0, 2), xPos+swidth, yPos+sheight/2+6); } float getPos() { return ((valueMAX-valueMIN)*(spos * ratio))/swidth; } } /////////////////////////////// //Buttons fn /////////////////////////////// int Bval=9; RectButton[] Buttons = new RectButton[10]; void initButtons(){ color base = color(200,200,200); color high = color(150,150,150); int w=15; int s=4; for(int i =0;i= x && mouseX <= x+width && mouseY >= y && mouseY <= y+height) { return true; } else { return false; } } //------------------------------------------------------------ //------------------------------------------------------------ //--( Vec3D )-- //------------------------------------------------------------ // Vec3D - simple 3D vector class // processing.unlekker.net class Vec3D { float x,y,z; Vec3D(){} Vec3D(float _x,float _y,float _z) { x=_x; y=_y; z=_z; } Vec3D(Vec3D v) { x=v.x; y=v.y; z=v.z; } void set(float _x,float _y,float _z) { x=_x; y=_y; z=_z; } void set(Vec3D v) { x=v.x; y=v.y; z=v.z; } void add(float _x,float _y,float _z) { x+=_x; y+=_y; z+=_z; } void add(Vec3D v) { x+=v.x; y+=v.y; z+=v.z; } void sub(float _x,float _y,float _z) { x-=_x; y-=_y; z-=_z; } void sub(Vec3D v) { x-=v.x; y-=v.y; z-=v.z; } void mult(float m) { x*=m; y*=m; z*=m; } void div(float m) { x/=m; y/=m; z/=m; } float length() { return sqrt(x*x+y*y+z*z); } void normalise() { float l=length(); if(l!=0) { x/=l; y/=l; z/=l; } } //////////////////////////////////// void rotateX(float val) { // Floats are not precise enough, so doubles are used for the calculations double cosval=Math.cos(val); double sinval=Math.sin(val); double tmp1=y*cosval - z*sinval; double tmp2=y*sinval + z*cosval; y=(float)tmp1; z=(float)tmp2; } void rotateY(float val) { // Floats are not precise enough, so doubles are used for the calculations double cosval=Math.cos(val); double sinval=Math.sin(val); double tmp1=x*cosval - z*sinval; double tmp2=x*sinval + z*cosval; x=(float)tmp1; z=(float)tmp2; } void rotateZ(float val) { // Floats are not precise enough, so doubles are used for the calculations double cosval=Math.cos(val); double sinval=Math.sin(val); double tmp1=x*cosval - y*sinval; double tmp2=x*sinval + y*cosval; x=(float)tmp1; y=(float)tmp2; } //////////////////////////////////// void transform(float[][] M){ x = M[0][0]*x + M[1][0]*y + M[2][0]*z + M[3][0]; y = M[0][1]*x + M[1][1]*y + M[2][1]*z + M[3][1]; z = M[0][2]*x + M[1][2]*y + M[2][2]*z + M[3][2]; } void translate(Vec3D V){ float[][] M = { {1,0,0}, {0,1,0}, {0,0,1}, {V.x,V.y,V.z} }; transform(M); } void scale(float _x,float _y,float _z){ float[][] M = { {_x,0,0}, {0,_y,0}, {0,0,_z}, {0,0,0} }; transform(M); } } //------------------------------------------------------------ //------------------------------------------------------------ //--( gPoint )-- //------------------------------------------------------------ class Vec3Doo extends Vec3D { Vec3Doo(){} Vec3Doo(float x,float y,float z) {this.x=x;this.y=y;this.z=z;} Vec3Doo(Vec3D v) {x=v.x;y=v.y;z=v.z;} //////////////////////////////////// float lengthRapid() { return x*x+y*y+z*z; } //////////////////////////////////// void normalize() { float l=length(); if(l!=0) { x/=l; y/=l; z/=l; } } //////////////////////////////////// void transform(float[][] M){ x = M[0][0]*x + M[1][0]*y + M[2][0]*z + M[3][0]; y = M[0][1]*x + M[1][1]*y + M[2][1]*z + M[3][1]; z = M[0][2]*x + M[1][2]*y + M[2][2]*z + M[3][2]; } void translate(Vec3Doo V){ float[][] M = { {1,0,0}, {0,1,0}, {0,0,1}, {V.x,V.y,V.z} }; transform(M); } void scale(float _x,float _y,float _z){ float[][] M = { {_x,0,0}, {0,_y,0}, {0,0,_z}, {0,0,0} }; transform(M); } void scale(float _x){ float[][] M = { {_x,0,0}, {0,_x,0}, {0,0,_x}, {0,0,0} }; transform(M); } void draw(){ line(0,0,0,x,y,z); } void setScalar(float Sc){ float OldLength = length(); float ratio = Sc/OldLength; scale(ratio); } } Vec3Doo vcross(Vec3Doo A, Vec3Doo B){ double Cx = (double)A.y*(double)B.z - (double)A.z*(double)B.y; double Cy = (double)A.z*(double)B.x - (double)A.x*(double)B.z; double Cz = (double)A.x*(double)B.y - (double)A.y*(double)B.x; return new Vec3Doo((float)Cx,(float)Cy,(float)Cz); } //------------------------------------------------------------ //------------------------------------------------------------ //--( Dome )-- //------------------------------------------------------------ void line(Vec3D a, Vec3D b) { line(a.x,a.y,a.z,b.x,b.y,b.z); } class Bloc{ Vec3D[] pt; int[][] l; Bloc(Vec3D[] _pt, int[][] _l) { pt = new Vec3D[_pt.length]; for(int i=0;i<_pt.length;i++) { pt[i]=new Vec3D(_pt[i]); //print("("+pt[i].x+"-"+pt[i].y+"-"+pt[i].z+")"); } //println(); l = new int[_l.length][2]; for(int i=0;i<_l.length;i++) { l[i][0]=_l[i][0]; l[i][1]=_l[i][1]; //print("("+l[i][0]+"-"+l[i][1]+")"); } //println(); } Bloc(Bloc unBloc) { pt = new Vec3D[unBloc.pt.length]; for(int i=0;i