int WIDTH=799; int HEIGHT=490; float ECOL=0.3; float EDRAG=0.999; float EG=0.25; int N; int NS; //long CT=0; int ITT=1; float GAP; float RIPRATIO=9999; //fabrix int NCOLS=65; int NROWS=30; int CurtainWidth=600; int TopRail=20; int PINMODE=0; int TEARMODE=0; float[] PX = new float[NCOLS * NROWS]; float[] PY = new float[NCOLS * NROWS]; float[] PX_OLD = new float[NCOLS * NROWS]; float[] PY_OLD = new float[NCOLS * NROWS]; boolean PINNED[]= new boolean [NCOLS * NROWS]; int STICKA[] = new int[(2*NCOLS*NROWS)-NROWS-NCOLS]; int STICKB[] = new int[(2*NCOLS*NROWS)-NROWS-NCOLS]; float STICKLENGTH[] = new float[(2*NCOLS*NROWS)-NROWS-NCOLS]; boolean STICKPRESENT[] = new boolean[(2*NCOLS*NROWS)-NROWS-NCOLS]; boolean RUNNING=true; boolean DISP=true; boolean FULLSHEET=true; void setup() { size(800, 600, P2D); reset(); } void draw() { background(0,0,0,0); noFill(); stroke(255); rect(0,0,WIDTH,HEIGHT); renderbuttons(); //if(CT++>3000) {reset(); RUNNING=false;} //fuze if (RUNNING) { updatepoints(); for (int i=0;i(RIPRATIO*GAP)) {STICKPRESENT[i]=false;} else { diff=STICKLENGTH[i]-dist; if (diff<0) { percent=diff/dist/2; offx=dx*percent; offy=dy*percent; if (!PINNED[STICKB[i]]) { PX[STICKB[i]]-=offx; PY[STICKB[i]]-=offy;} if (!PINNED[STICKA[i]]) { PX[STICKA[i]]+=offx; PY[STICKA[i]]+=offy;} } } } } } void constrainpoints() { float VX,VY; for (int i=0;iWIDTH) { PX[i]=WIDTH; PX_OLD[i]=(PX[i]+(VX*ECOL)); } else if (PX[i]<0) { PX[i]=0; PX_OLD[i]=(PX[i]+(VX*ECOL)); } if (PY[i]>HEIGHT) { PY[i]=HEIGHT; PY_OLD[i]=(PY[i]+(VY*ECOL)); } else if (PY[i]<0) { PY[i]=0; PY_OLD[i]=(PY[i]+(VY*ECOL)); } } } void updatepoints() { float VX,VY; for (int i=0;i=510 && mouseY<=540 && mouseX>0 && mouseX<100) {RUNNING=!RUNNING; if(!RUNNING) {reset();}} if ( mouseY>=550 && mouseY<=580 && mouseX>110 && mouseX<210) {FULLSHEET=!FULLSHEET; reset();} if ( mouseY>=540 && mouseY<=580 && mouseX>0 && mouseX<100) {DISP=!DISP;} if ( mouseY>=510 && mouseY<=540 && mouseX>400 && mouseX<750) {PINMODE=int((mouseX-400)/90); reset();} if ( mouseY>=550 && mouseY<=580 && mouseX>400 && mouseX<750) {TEARMODE=int((mouseX-400)/90); updatetearmode();} } void updatetearmode() { switch(TEARMODE) { case 0: RIPRATIO=99999;break; case 1: RIPRATIO=25;break; case 2: RIPRATIO=9;break; case 3: RIPRATIO=3.5;break; } } void nickmousemove() { float dista; for(int i=0;i