memoscan
← all memos

Memo 0x614c345b…ceea0c on Ethereum

///9 case ST5:const e=this.PRPA,m=(t-1)/e;if(m>=3)for(let t=0;t<m-2;t++)for(let m=1;m<=e;m++){const i=m+e*t,P=m+e*(t+1),h=m+e*(t+2),l=this.pIs[i],a=this.pIs[P],o=this.pIs[h];let S=myPs[l],d=myPs[a],r=myPs[o];1==s?(y=Sb(S.p0,d.p0),p=Sb(r.p0,d.p0)):(y=Sb(S.pE,d.pE),p=Sb(r.pE,d.pE)),y.normalize(),p.normalize();let I=Ad(y,p).mult(this.SMOOTHING);myPs[a].addF(I.x,I.y,s),myPs[l].addF(-I.x/2,-I.y/2,s),myPs[o].addF(-I.x/2,-I.y/2,s)}break; case ST1:case ST0:{this.type==ST1?(StSh.loopSmth=2.5,this.SMOOTHING=StSh.loopSmth):this.type==ST0&&(this.SMOOTHING=StSh.lineStructureSmoothing);const e=this.bLoop?0:1,m=this.bLoop?t:t-1;for(let i=e;i<m;i++){const e=(i-1+t)%t,m=(i+1)%t,P=this.pIs[e],h=this.pIs[i],l=this.pIs[m];let a=myPs[P],o=myPs[h],S=myPs[l];1==s?(y=Sb(a.p0,o.p0),p=Sb(S.p0,o.p0)):(y=Sb(a.pE,o.pE),p=Sb(S.pE,o.pE)),y.normalize(),p.normalize();let d=Ad(y,p).mult(this.SMOOTHING);myPs[h].addF(d.x,d.y,s),myPs[P].addF(-d.x/2,-d.y/2,s),myPs[l].addF(-d.x/2,-d.y/2,s)}}break; case ST3:case ST4:{const y=t/2,p=this.bLoop?0:1,e=this.bLoop?y:y-1;let m,i,P,h,l,a,o,S;for(let y=p;y<e;y++)for(let p=0;p<=1;p++){const e=(2*(y-1)+p+t)%t,d=(2*y+p)%t,r=(2*(y+1)+p)%t,I=this.pIs[e],x=this.pIs[d],n=this.pIs[r];if(1==s){let s=myPs[I].p0,t=myPs[x].p0,y=myPs[n].p0;m=s.x-t.x,i=s.y-t.y,h=y.x-t.x,l=y.y-t.y}else{let s=myPs[I].pE,t=myPs[x].pE,y=myPs[n].pE;m=s.x-t.x,i=s.y-t.y,h=y.x-t.x,l=y.y-t.y}P=Math.sqrt(m*m+i*i),a=Math.sqrt(h*h+l*l),o=this.SMOOTHING*(m/P+h/a),S=this.SMOOTHING*(i/P+l/a),myPs[x].addF(o,S,s),myPs[I].addF(-o/2,-S/2,s),myPs[n].addF(-o/2,-S/2,s)}}break; case ST8:if(mouseIsPressed){let e=t/4,m=.333;for(let t=1;t<e-1;t++)for(let e=0;e<=1;e++){const i=4*(t-1)+e,P=4*t+e,h=4*(t+1)+e,l=this.pIs[i],a=this.pIs[P],o=this.pIs[h];let S=myPs[l],d=myPs[a],r=myPs[o];1==s?(y=Sb(S.p0,d.p0),p=Sb(r.p0,d.p0)):(y=Sb(S.pE,d.pE),p=Sb(r.pE,d.pE)),y.normalize(),p.normalize();let I=Ad(y,p).mult(m);myPs[l].addF(-I.x/2,-I.y/2,s),myPs[o].addF(-I.x/2,-I.y/2,s)}}break; case ST7:{let e,m,i,P,h,l,a,o,S=2+this.PRPA,d=t/S;for(let r=0;r<d;r++){for(let y=0;y<=1;y++){const p=this.pIs[((r-1)*S+y+t)%t],d=this.pIs[(r*S+y)%t],I=this.pIs[((r+1)*S+y)%t];if(1==s){let s=myPs[p].p0,t=myPs[d].p0,y=myPs[I].p0;e=s.x-t.x,m=s.y-t.y,P=y.x-t.x,h=y.y-t.y}else{let s=myPs[p].pE,t=myPs[d].pE,y=myPs[I].pE;e=s.x-t.x,m=s.y-t.y,P=y.x-t.x,h=y.y-t.y}i=Math.sqrt(e*e+m*m),l=Math.sqrt(P*P+h*h),a=this.SMOOTHING*(e/i+P/l),o=this.SMOOTHING*(m/i+h/l),myPs[d].addF(a,o,s),myPs[p].addF(-a/2,-o/2,s),myPs[I].addF(-a/2,-o/2,s)}for(let t=1;t<S-1;t++){const e=r*S+t-1,m=r*S+t,i=r*S+t+1,P=this.pIs[e],h=this.pIs[m],l=this.pIs[i];let a=myPs[P],o=myPs[h],d=myPs[l];1==s?(y=Sb(a.p0,o.p0),p=Sb(d.p0,o.p0)):(y=Sb(a.pE,o.pE),p=Sb(d.pE,o.pE)),y.normalize(),p.normalize();let I=Ad(y,p).mult(this.SMOOTHING);myPs[h].addF(I.x,I.y,s),myPs[P].addF(-I.x/2,-I.y/2,s),myPs[l].addF(-I.x/2,-I.y/2,s)}}}}} applyScrunchingForces(s){const t=this.pIs.length;if(t>10){const y=T,p=T;let i,e;switch(this.type){default:break; case ST5:const m=this.PRPA;let d=(t-1)/m;if(d>=5)for(let t=0;t<d-4;t++)for(let p=1;p<=m;p++){const d=this.pIs[p+m*t],a=this.pIs[p+m*(t+2)],l=this.pIs[p+m*(t+4)];let P=myPs[d],h=myPs[a],o=myPs[l];if(y){1==s?(i=Sb(o.p0,h.p0),e=Sb(P.p0,h.p0)):(i=Sb(o.pE,h.pE),e=Sb(P.pE,h.pE)),i.normalize(),e.normalize();let t=Ad(i,e).mult(this.SCRUNCHING);myPs[a].addF(-t.x,-t.y,s),myPs[l].addF(t.x/2,t.y/2,s),myPs[d].addF(t.x/2,t.y/2,s)}}break; case ST3:case ST4:if(y){let y,p,i,e,m,d,a,l,P=t/2,h=this.bLoop?0:3,o=this.bLoop?P:P-3;for(let P=h;P<o;P++)for(let h=0;h<=1;h++){const o=(2*(P-3)+h+t)%t,S=(2*P+h)%t,x=(2*(P+3)+h)%t,I=this.pIs[o],b=this.pIs[S],c=this.pIs[x];if(1==s){let s=myPs[I].p0,t=myPs[b].p0,i=myPs[c].p0;y=i.x-t.x,p=i.y-t.y,e=s.x-t.x,m=s.y-t.y}else{let s=myPs[I].pE,t=myPs[b].pE,i=myPs[c].pE;y=i.x-t.x,p=i.y-t.y,e=s.x-t.x,m=s.y-t.y}i=Math.sqrt(y*y+p*p),d=Math.sqrt(e*e+m*m),y/=i,p/=i,e/=d,m/=d,a=this.SCRUNCHING*(y+e),l=this.SCRUNCHING*(p+m),myPs[S].addF(-a,-l,s),myPs[x].addF(a/2,l/2,s),myPs[o].addF(a/2,l/2,s)}}break; case ST1:case ST0:{let m=this.bLoop?0:3;for(let d=m;d<t-m;d++){const m=(d-2+t)%t,a=(d-1+t)%t,l=(d+1)%t,P=(d+2)%t,h=this.pIs[m],o=this.pIs[a],S=this.pIs[d],x=this.pIs[l],I=this.pIs[P];let b=myPs[h],c=myPs[S],r=myPs[I];if(y){1==s?(i=Sb(r.p0,c.p0),e=Sb(b.p0,c.p0)):(i=Sb(r.pE,c.pE),e=Sb(b.pE,c.pE)),i.normalize(),e.normalize();let t=Ad(i,e).mult(this.SCRUNCHING);myPs[S].addF(-t.x,-t.y,s),myPs[I].addF(t.x/2,t.y/2,s),myPs[h].addF(t.x/2,t.y/2,s)}if(p){let t;t=1==s?Sb(r.p0,b.p0):Sb(r.pE,b.pE);let y=t.mult(this.TWISTING);myPs[h].addF(y.x,y.y,s),myPs[I].addF(-y.x,-y.y,s),y=t.mult(.6),d%2==0?(myPs[o].addF(-y.y,y.x,s),myPs[x].addF(y.y,-y.x,s)):(myPs[o].addF(y.y,-y.x,s),myPs[x].addF(-y.y,y.x,s))}}}}}} applyLetterForces(t){if(bDoLetters&&this.type==ST12)if(this.labelsStructureID>0&&this.labelsStructureID<mySs.length){let s=mySs[this.labelsStructureID],e=s.getCentroidWhichpass(t),i=this.pIs[0],l=myPs[i],h=1==t?l.p0:l.pE,P=e.x-h.x,R=e.y-h.y,r=P*P+R*R,y=s.pointInside(h.x,h.y)?StSh.adequateLetterCloseness:REST_L;if(r>y*y){let s=CV(P/r,R/r);const e=40;s.mult(e),s.limit(1),myPs[i].addF(s.x,s.y,t)}}else if(null!=this.PRPC&&null!=this.PRPC.x&&null!=this.PRPC.y){let s=this.pIs[0],e=myPs[s],i=1==t?e.p0:e.pE,l=this.PRPC.x-i.x,h=this.PRPC.y-i.y,P=sqrt(l*l+h*h)/REST_L;P>5?this.applyForceTowardsTarget(this.PRPC.x,this.PRPC.y,t,.2):P<2&&this.applyForceTowardsTarget(this.PRPC.x,this.PRPC.y,t,-.2)}} getContours(s=F){let t=[],e=[],p=[];const l=this.springs.length;let h=F,y=this.getEnclosingStructureId();if(-1!=y)if(mySs[y].type==ST4){12==mySs[y].STID&&(h=T)}else if(mySs[y].type==ST1){let s=mySs[y].STID;1!=s&&3!=s&&4!=s||(h=T)}switch(this.type){ case ST13:if(StSh.bImplementBorders){resetRnd(CHASH);let s=myR01()<.4?2:3,e=1.25*W3,p=2==s?W0:W1,l=W0,h=myRAB(.0022,.0035),y=[e,p,l],i=.12,n=1-i,P=.08,I=1-P,u=myRGauss(0,Rd(.2)),S=sin(u),a=cos(u),o=BDM/2,r=BDM/2,m=[],_=[];for(let s=0;s<4;s++)m[s]=myRAB(-1,1),_[s]=myRAB(-1,1);for(let e=0;e<s;e++){let s=y[e],p=[BDM*i,BDM*i,BDM*n,BDM*n],l=[BDM*P,BDM*I,BDM*I,BDM*P],u=[-s,s,0,0,s,-s,0,0],f=[0,0,-s,s,0,0,s,-s];const c=10;let x=.49;StSh.bUseVSh||(x=-1);for(let s=0;s<4;s++){let h=[],i=(s+1)%4,n=o+(p[s]-o)*a-(l[s]-r)*S+m[s]+x*f[2*s],P=r+(p[s]-o)*S+(l[s]-r)*a+_[s]+x*u[2*s],I=o+(p[i]-o)*a-(l[i]-r)*S+m[i]+x*f[2*s+1],W=r+(p[i]-o)*S+(l[i]-r)*a+_[i]+x*u[2*s+1];for(let s=0;s<=c;s++){let t=map(s,0,c,n,I),e=map(s,0,c,P,W);s>0&&s<c&&(t+=.5*myRAB(-1,1),e+=.5*myRAB(-1,1)),0!=s&&s!=c||h.push(CV(t+1e-4,e)),h.push(CV(t,e))}t.push(new StyPl(h,F,T,F,F,STR_BK,FIL_NO,y[e],0,0,T)),h=null}i+=y[e]*h,n-=y[e]*h,P+=y[e]*h,I-=y[e]*h}}break; case ST12:if(bDoLetters){let s=this.pIs.length;for(let t=1;t<s;t++){const s=this.pIs[t];e.push(myPs[s].p)}if(t.push(new StyPl(e,T,T,F,F,STR_NO,FIL_NO,W1,0,0,F)),e=null,this.PRPC=null,-1==this.siteAttachId&&-1==this.labelsStructureID&&-1==this.isEnclosedByStructureID){const s=9*REST_L,e=1.5*REST_L;let p=myPs[this.pIs[0]].p.x,l=myPs[this.pIs[0]].p.y,h=determineClosestPointOnLoop(p,l,s);if(h.valid){let p=myPs[this.pIs[0]].p,l=CV(h.x,h.y),y=l.x-p.x,i=l.y-p.y,n=sqrt(y*y+i*i);if(n>e){let h=p.x+y/n*REST_L,P=p.y+i/n*REST_L,I=l.x,u=l.y;this.PRPC=CV(I,u);const S=.5*REST_L,a=dist(h,P,I,u),o=a/S,r=pow(map(a,e,s,.75,0,T),1.25),m=myMillis%1300/1300;for(let s=-1;s<o;s++){const e=s+m,p=map(e,0,o,0,1,T),l=map(min(e+r,o),0,o,0,1,T),y=map(p,0,1,h,I),i=map(p,0,1,P,u),n=map(l,0,1,h,I),S=map(l,0,1,P,u);let a=[];a.push(CV(y,i)),a.push(CV(n,S)),t.push(new StyPl(a,F,F,F,F,STR_BK,FIL_BK,W0,0,0,F)),a=null}}}}}break; case ST11:if(s)return t;StSh.bDoRings&&StSh.bEnableRingsOrHairs&&(t=getOffsetCurveContours(this));break; case ST10:if(s)return t;{let s=this.pIs.length/nMaskPoints;if(0==s){for(let s=0;s<nMaskPoints;s++)e.push(myPs[s].p);let s=new StyPl(e,T,T,F,F,STR_BK,FIL_NO,W3,0,0,T);t.push(s),s=null,e=null}else{let e=1,p=s-1,l=s<=3?0:StSh.mbrLoopIndent,h=0,y=F,i=F,n=F,P=F,I=F,u=StSh.bAddMiniNuclei,S=F,a=F,o=StSh.mbr_bAddDitherDots,r=2,m=4;switch(resetRnd(CHASH),this.STID){default:case 0:e=0,p=2*s;break;case 1:e=1,p=s-1;break;case 2:e=3,p=s-1,I=T;break;case 3:e=StSh.mbr3pointSkip,p=s-1,h=~~(s/2),I=T,1==StSh.mbr3variant?(p=1,n=T):2==StSh.mbr3variant?a=T:3==StSh.mbr3variant&&(y=T);break;case 4:e=0,p=1,n=T;break;case 5:y=T,p=2*s,e=1;break;case 6:e=0,p=0;break;case 7:i=T,P=T,e=1,p=s-1;break;case 8:i=T,y=T,e=1,p=2*s;break;case 9:e=1,i=T,p=s-1;break;case 10:e=3,r=2,m=4,p=s-1,I=T,S=T;break;case 11:i=T,P=T,p=s-1,S=T,e=1,r=1,m=3;break;case 12:e=0,a=T}if(o){let s=0;const e=this.pIs.length-nMaskPoints,p=e-nMaskPoints;let h=null,y=null;for(let i=l*nMaskPoints;i<this.pIs.length;i++){const n=sq(1-i/this.pIs.length),P=n*W1,I=this.pIs[i],u=myPs[I].p.x,S=myPs[I].p.y;if(i<nMaskPoints){if(R20K[s++]<n){let s=(i+1)%nMaskPoints;const e=this.pIs[s],p=myPs[e].p.x,l=myPs[e].p.y,n=i+nMaskPoints,I=this.pIs[n],a=(u+p+myPs[I].p.x)/3,o=(S+l+myPs[I].p.y)/3;y=[],y.push(CV(a,o)),h=new StyPl(y,F,F,F,T,STR_BK,FIL_NO,P,0,0,F),t.push(h)}}else if(R20K[s++]<n&&(y=[],y.push(myPs[I].p),h=new StyPl(y,F,F,F,T,STR_BK,FIL_NO,P,0,0,F),t.push(h)),i<e){let I=i-1,a=i-nMaskPoints,o=i+nMaskPoints-1;i%nMaskPoints==0&&(o++,a++,I+=nMaskPoints-1);const r=this.pIs[I],m=myPs[r].p.x,_=myPs[r].p.y,f=this.pIs[o],c=myPs[f].p.x,x=myPs[f].p.y;if(R20K[s++]<n){const s=(m+u+c)/3,e=(_+S+x)/3;y=[],y.push(CV(s,e)),h=new StyPl(y,F,F,F,T,STR_BK,FIL_NO,P,0,0,F),t.push(h)}if((0==l||a>nMaskPoints)&&R20K[s++]<n){const s=this.pIs[a],e=(m+u+myPs[s].p.x)/3,p=(_+S+myPs[s].p.y)/3;y=[],y.push(CV(e,p)),h=new StyPl(y,F,F,F,T,STR_BK,FIL_NO,P,0,0,F),t.push(h)}if(i>=p&&R20K[s++]<n){let s=i+1,l=myPs[f].p.x,n=myPs[f].p.y;if(i==p){const t=i+2*nMaskPoints-1,e=this.pIs[t];l=myPs[e].p.x,n=myPs[e].p.y,s--}else i==e-1&&(s-=nMaskPoints);const I=this.pIs[s],u=(myPs[I].p.x+c+l)/3,S=(myPs[I].p.y+x+n)/3;y=[],y.push(CV(u,S)),h=new StyPl(y,F,F,F,T,STR_BK,FIL_NO,P,0,0,F),t.push(h)}}s>MaxNPs&&(s=0)}h=null,y=null}if(e>0){let p=0,n=i?nMaskPoints+e:nMaskPoints;const a=StSh.radBW[0],o=StSh.radBW[1],_=s%2==1;let f=0,c=0,x=e;const W=[W1,W2];for(let R=h;R<n;R+=e){if(p>MaxNPs&&(p=0),S){let s=R20K[p++];e=int(Math.round(r+(m-r)*s))}let n=[],L=s/2,B=2*nMaskPoints,K=R%nMaskPoints+l*nMaskPoints,k=0,w=L;if(_&&(w=L-l),1==l&&3==this.STID){for(let s=0;s<w;s++){let t=this.pIs[K];if(s>0){const s=(myPs[k].p.x+myPs[t-1].p.x)/2,e=(myPs[k].p.y+myPs[t-1].p.y)/2;n.push(CV(s,e))}let e=(myPs[t].p.x+myPs[this.pIs[K-l]].p.x)/2,p=(myPs[t].p.y+myPs[this.pIs[K-l]].p.y)/2;n.push(CV(e,p)),K+=B-1,R%nMaskPoints==s&&(K+=nMaskPoints),k=t}if(s>3&&(0==l&&!_||1==l&&_)){K=K+nMaskPoints-B;let s=K+1;s>=this.pIs.length&&(s-=nMaskPoints);let t=this.pIs[K],e=(this.pIs[s],myPs[t].p.x),p=myPs[t].p.y,l=CV(e,p);n.push(l)}}else{for(let s=0;s<w;s++){let t=this.pIs[K];if(s>0){let s=(myPs[k].p.x+myPs[t].p.x)/2,e=(myPs[k].p.y+myPs[t].p.y)/2,p=CV(s,e);n.push(p)}n.push(myPs[t].p),K+=B-1,R%nMaskPoints==s&&(K+=nMaskPoints),k=t}if(s>3&&(0==l&&!_||1==l&&_)){K=K+nMaskPoints-B;let s=K+1;s>=this.pIs.length&&(s-=nMaskPoints);let t=this.pIs[K],e=this.pIs[s],p=(myPs[t].p.x+myPs[e].p.x)/2,l=(myPs[t].p.y+myPs[e].p.y)/2,h=CV(p,l);n.push(h)}}if(u){let s=(n[0].x+n[n.length-1].x)/2,p=(n[0].y+n[n.length-1].y)/2;if(R!=h&&R20K[R]<.9){let e=CV((s+f)/2,(p+c)/2),l=W[Math.round(map(x,r,m,0,1,T))];t.push(new StyPl([e],F,F,F,T,STR_NO,FIL_BK,l,0,0))}f=s,c=p,x=e}if(i&&t.length>0){let s=t[t.length-1].verts,e=[];for(let t=0;t<s.length;t++){let p=(s[t].x+n[t].x)/2,l=(s[t].y+n[t].y)/2,h=CV(p,l);e.push(h)}let p=new StyPl(e,F,T,y,F,STR_BK,FIL_NO,o,P?1:0,P?2:0);t.push(p),p=null,e=null}if(R<nMaskPoints){let s=new StyPl(n,F,T,y,F,STR_BK,FIL_NO,a,0,0);if(t.push(s),I){const s=n.length;if(s>=2){let e=[],p=s>2?2:1,l=n[0].x,h=n[0].y,y=n[p].x,i=n[p].y;e=this.createWedgePolyline(l,h,y,i,W3,3,.33),t.push(new StyPl(e,F,F,F,F,STR_BK,FIL_NO,W0,0,0));let T=n.length,P=n[T-1].x,I=n[T-1].y,u=n[T-p].x,S=n[T-p].y;e=this.createWedgePolyline(P,I,u,S,W3,3,.33),t.push(new StyPl(e,F,F,F,F,STR_BK,FIL_NO,W0,0,0)),e=null}}s=null,n=null}}}if(T){let s=[];for(let t=0;t<nMaskPoints;t++)s.push(myPs[this.pIs[t]].p);let e=new StyPl(s,T,T,F,F,STR_BK,FIL_NO,W3,0,0,T);t.push(e),e=null,s=null}if(1==l){let s=[],e=2*nMaskPoints;for(let t=nMaskPoints;t<e;t++)s.push(myPs[this.pIs[t]].p);let p=StSh.loopIndentWeight,l=new StyPl(s,T,T,F,F,STR_BK,FIL_NO,p,0,0,T);t.push(l),l=null,s=null}if(p>0)if(n)for(let e=p;e<s;e+=p){let p,l=e*nMaskPoints,h=l+nMaskPoints,y=[];for(let s=l;s<h;s++){const t=this.pIs[s];y.push(myPs[t].p)}e==s-1?(p=new StyPl(y,T,T,F,F,STR_BK,FIL_NO,W2,0,0,T),t.push(p)):(p=new StyPl(y,T,F,F,F,STR_BK,FIL_NO,W0,1,6),t.push(p)),p=null,y=null}else{let e=3==this.STID?F:T,l=[];for(let h=p;h<s;h+=p){let s=h*nMaskPoints,p=s+nMaskPoints;l=[];for(let t=s;t<p;t++){const s=this.pIs[t];l.push(myPs[s].p)}let y=new StyPl(l,T,T,F,F,STR_BK,FIL_NO,W2,0,0,e);t.push(y),y=null}l=null}if(6==this.STID){for(let e=0;e<nMaskPoints;e++){let p=[],l=s/2,h=2*nMaskPoints,y=e;for(let s=0;s<l;s++){let t=this.pIs[y];p.push(myPs[t].p),y+=h-1,e==s&&(y+=nMaskPoints)}if(s>2){y-=h-1,y+=-1;let s=this.pIs[y];p.push(myPs[s].p)}let i=R20K[3]<.975?W0:W1,n=new StyPl(p,F,T,F,F,STR_BK,FIL_NO,i,0,0);t.push(n),n=null,p=null}if(s%2==0){let e=[],p=(s-1)*nMaskPoints;for(let s=0;s<nMaskPoints;s++)e.push(myPs[this.pIs[s+p]].p);let l=new StyPl(e,T,T,F,F,STR_BK,FIL_NO,W2,0,0,T);t.push(l),l=null,e=null}}if(a){let e=s-1;if(e>1)for(let p=0;p<nMaskPoints;p++){let h=[];for(let t=l;t<e;t++){let e=p+t*(nMaskPoints+1);t>0&&p>=nMaskPoints-s&&(e=t*nMaskPoints+(p+t)%nMaskPoints);let l=myPs[e].p;h.push(l)}let y=(W0+W1)/2;2==e?t.push(new StyPl(h,F,F,F,F,STR_NO,FIL_BK,y,0,0,T)):t.push(new StyPl(h,F,T,F,F,STR_BK,FIL_NO,y,0,0,T)),h=null}}}if(StSh.doMbrHairs&&StSh.bEnableRingsOrHairs){let s=StSh.mbrHairSkip,e=REST_L*StSh.mbrHairLengthFactor,p=StSh.mbrHairWeight,l=0;for(let h=0;h<nMaskPoints;h+=s){l>MaxNPs&&(l=0);let s=myPs[h].p,y=myPs[(h+1)%nMaskPoints].p,i=y.x-s.x,n=y.y-s.y,P=Math.sqrt(i*i+n*n);if(P>0){let I=StSh.mbrHairsPerSeg;if(1==I){let h=[],y=e*(.95+.1*R20K[l++]),I=CV(s.x+y*n/P,s.y-y*i/P);h.push(s),h.push(I),t.push(new StyPl(h,F,F,T,F,STR_NO,FIL_BK,p,0,0)),h=null}else{let u=myPs[(h+2)%nMaskPoints].p,S=u.x-y.x,a=u.y-y.y,o=Math.sqrt(S*S+a*a);if(o>0)if(StSh.doMbrHairsStubbly)for(let h=0;h<I;h++){let h=R20K[l++],I=e*(.95+.1*R20K[l++]),u=s.x+I*n/P,r=s.y-I*i/P,m=u+h*(y.x+I*a/o-u),_=r+h*(y.y-I*S/o-r),f=[];f.push(CV(s.x+h*i,s.y+h*n)),f.push(CV(m,_)),t.push(new StyPl(f,F,F,T,F,STR_NO,FIL_BK,p,0,0)),f=null}else for(let h=0;h<I;h++){let u=h/I,r=[],m=e*(.95+.1*R20K[l++]),_=s.x+u*i,f=s.y+u*n,c=s.x+m*n/P,x=s.y-m*i/P,W=c+u*(y.x+m*a/o-c),R=x+u*(y.y-m*S/o-x);r.push(CV(_,f)),r.push(CV(W,R)),t.push(new StyPl(r,F,F,T,F,STR_NO,FIL_BK,p,0,0)),r=null}}}}}if(StSh.doMbrExtraInnerMbr&&this.pIs.length>0){let s=[],e=REST_L*StSh.mbrExtraInnerMbrSeparation,p=this.pIs.length,l=p-nMaskPoints,h=this.pIs[p-1];for(let t=l;t<p;t++){let p=this.pIs[t],l=myPs[p].p.x,y=myPs[p].p.y,i=l-myPs[h].p.x,n=y-myPs[h].p.y,F=i*i+n*n;if(F>0){let t=Math.sqrt(F);i=e*i/t,n=e*n/t,s.push(CV(l-n,y+i))}h=p}let y=new StyPl(s,T,T,F,F,STR_BK,FIL_NO,W1,0,0,T);t.push(y),y=null,s=null}}break; case ST9:{let p=STR_BK,l=FIL_NO,h=F,y=T,i=F,n=F,P=F,I=F,u=F,S=F,a=F,o=F,r=1,m=W2;if(s)h=F,y=F,i=F,n=F,P=F,I=F,u=F,S=F,r=1;else switch(this.STID){case 0:a=StSh.bBallCenterDot,P=T,l=FIL_WH;break;case 1:h=T,l=FIL_WH;break;case 2:a=StSh.bBallCenterDot,p=STR_WH,l=FIL_BK,m=W1;break;case 3:I=T,l=FIL_WH;break;case 4:n=T,l=FIL_WH;break;case 5:i=T,I=T,S=F,l=FIL_WH;break;case 6:i=T,l=FIL_WH,m=(W2+W3)/2,S=T;break;case 8:m=(W1+W2)/2,l=FIL_WH,o=T,S=F;break;case 10:a=StSh.bBallCenterDot,P=T,o=T,l=FIL_WH;break;case 11:h=T,o=T,l=FIL_WH;break;case 13:m=W1,l=FIL_WH,o=T,I=T;break;case 14:n=T,o=T,l=FIL_WH}let _=this.pIs.length;for(let s=1;s<_;s++){const t=this.pIs[s];e.push(myPs[t].p)}if(t.push(new StyPl(e,T,T,F,F,p,l,m,0,0,S)),e=null,o){let s=0,e=0;for(let t=1;t<_;t++)s+=myPs[this.pIs[t]].p.x,e+=myPs[this.pIs[t]].p.y;s/=_-1,e/=_-1;let p=0;for(let t=1;t<_;t++){let l=myPs[this.pIs[t]].p.x-s,h=myPs[this.pIs[t]].p.y-e,y=Math.sqrt(l*l+h*h);y>p&&(p=y)}let l=.75*p,h=.85*PI2,y=l*cos(h),i=l*sin(h);s+=y,e+=i;for(let l=1;l<_;l++){let h=this.pIs[l],n=myPs[h].p.x,P=myPs[h].p.y,I=l+1;I==_&&(I=1);let u=this.pIs[I],S=myPs[u].p.x,a=myPs[u].p.y,o=S-n,r=a-P,m=Math.sqrt(o*o+r*r),f=y*r/m-i*o/m;if(f<0){let l=max(1,~~(Math.abs(f)/2));for(let h=0;h<l;h++){let I=(h+myRAB(.1,.3))/l,u=n*(1-I)+S*I,o=P*(1-I)+a*I,r=y*y+i*i,m=2*(y*(u-s)+i*(o-e)),_=s*s+e*e;_+=u*u+o*o,_-=2*(s*u+e*o),_-=p*p;let f=m*m-4*r*_;if(!(Math.abs(r)<1e-6||f<0)){let s=(-m-Math.sqrt(f))/(2*r),e=u+s*y,p=o+s*i,l=[];l.push(CV(u,o)),l.push(CV(e,p)),t.push(new StyPl(l,F,F,T,F,STR_BK,FIL_BK,W1,0,0)),l=null}}}}}if(h){let s=myPs[this.pIs[0]].p,e=l==FIL_BK?FIL_WH:FIL_BK;if(u)for(let l=1;l<_;l+=r){let h=[];h.push(myPs[this.pIs[l]].p),h.push(s),t.push(new StyPl(h,F,F,y,F,p,e,W1,0,0));let i=myPs[this.pIs[l]].p.x,n=myPs[this.pIs[l]].p.y,T=i-s.x,P=n-s.y,I=Math.sqrt(T*T+P*P);T=W1*T/I,P=W1*P/I;let u=.6*i+.4*s.x,S=.6*n+.4*s.y;for(let s=-2;s<=2;s++)h=[],h.push(CV(u,S)),h.push(CV(i-s*P,n+s*T)),t.push(new StyPl(h,F,F,y,F,p,e,W1,0,0)),h=null}else for(let l=1;l<_;l+=r){let h=[];h.push(s),h.push(myPs[this.pIs[l]].p),t.push(new StyPl(h,F,F,y,F,p,e,W1,0,0)),h=null}}if(P){let s=myPs[this.pIs[0]].p,e=W1*(S&&StSh.bUseVSh?.5:1.618);for(let p=1;p<_;p++){const l=this.pIs[p];let h=myPs[l].p.x-s.x,i=myPs[l].p.y-s.y,n=Math.sqrt(h*h+i*i);h=h/n*e,i=i/n*e;let P=myPs[l].p.x+h,I=myPs[l].p.y+i,u=[];u.push(CV(P,I)),t.push(new StyPl(u,F,F,y,T,STR_NO,FIL_BK,W3,0,0)),u=null}}if(a){let s=myPs[this.pIs[0]].p,e=[];e.push(s),l==FIL_WH?t.push(new StyPl(e,F,F,F,T,STR_BK,FIL_BK,W0,0,0)):l==FIL_BK&&t.push(new StyPl(e,F,F,F,T,STR_WH,FIL_WH,W1,0,0)),e=null}if(i){let s=.333,e=1-s,p=0,l=0;for(let s=1;s<_;s++){let t=myPs[this.pIs[s]].p;p+=t.x,l+=t.y}p/=_-1,l/=_-1;let h=F,y=1;if(mouseIsPressed){let s=0,t=0;for(let e=1;e<_;e++){let p=myPs[this.pIs[0]].p,l=myPs[this.pIs[e]].p,h=p.x-l.x,i=p.y-l.y,n=Math.sqrt(h*h+i*i);s+=n,n>t&&(t=n,y=e)}s/=_-1,s*=.75*e;let i=mouseX-p,n=mouseY-l,F=Math.sqrt(i*i+n*n);if(F>0){s*=Math.pow(Math.min(1,F/(BDM/2)),.25),i/=F,n/=F,p+=i*s,l+=n*s,myFrmCnt%600==10*this.id&&(h=T)}}let i=[];for(let t=1;t<_;t++){const h=this.pIs[t];let y=s*myPs[h].p.x+e*p,n=s*myPs[h].p.y+e*l;i.push(CV(y,n))}let n=h?FIL_NO:FIL_BK;t.push(new StyPl(i,T,T,F,F,STR_BK,n,W0,0,0)),i=null}if(I){let s=myPs[this.pIs[0]].p,e=[],p=W2*(StSh.bUseVSh?2:1.414);for(let t=1;t<_;t++){const l=this.pIs[t];let h=myPs[l].p.x-s.x,y=myPs[l].p.y-s.y,i=Math.sqrt(h*h+y*y);h=h/i*p,y=y/i*p;let n=myPs[l].p.x-h,F=myPs[l].p.y-y;e.push(CV(n,F))}t.push(new StyPl(e,T,T,F,F,STR_BK,FIL_NO,W0,0,0)),e=null}if(n){let s=myPs[this.pIs[0]].p;const e=s.x,p=s.y,l=5*(_-1);let h=[];for(let s=0;s<=l;s++){let t=s/l,y=1-t,i=1+s%(_-1),n=this.pIs[i],F=t*myPs[n].p.x+y*e,T=t*myPs[n].p.y+y*p;h.push(CV(F,T))}t.push(new StyPl(h,F,T,F,F,STR_BK,FIL_NO,W0,0,0)),h=null}}break; case ST5:{let s=F,e=F,p=F,l=F,y=W1,i=W2,n=F,P=F;switch(this.STID){case 0:break;case 1:s=T;break;case 2:e=T,P=R20K[4]<.3,i=R20K[5]<.2?W1:W2,s=F,y=W0;break;case 3:y=W2,p=T,s=T,n=StSh.bDoStarCenterDot;break;case 4:y=W1,p=T,s=F,e=T,P=R20K[4]<.15,i=R20K[5]<.8?W1:W2;break;case 5:y=W1,p=T,s=F,e=T,P=R20K[4]<.2,i=R20K[5]<.15?W1:W2,l=T;break;case 6:y=W0,l=T,p=T}let I=FIL_BK,u=STR_BK;h&&(I=FIL_WH,u=STR_WH);const S=this.PRPA,a=this.pIs[0];let o=(this.pIs.length-1)/S;for(let e=1;e<=S;e++){let p=[];p.push(myPs[a].p);for(let s=0;s<o;s++){const t=e+S*s,l=this.pIs[t];p.push(myPs[l].p)}1==o?t.push(new StyPl(p,F,T,s,F,STR_NO,I,y,0,0)):t.push(new StyPl(p,F,T,s,F,u,FIL_NO,y,0,0)),p=null}if(p){const s=this.pIs[0];let e=myPs[s].p,p=e.x,l=e.y,h=10;for(let s=1;s<=S;s++){const e=s%S+1,y=(s+1)%S+1,i=this.pIs[e],n=this.pIs[y];let P=myPs[i].p.x,u=myPs[i].p.y,a=myPs[n].p.x,o=myPs[n].p.y;for(let s=0;s<h;s++){const e=s/h,y=1-e;let i=e*p+y*P,n=e*l+y*u,S=y*p+e*a,r=y*l+e*o,m=[];m.push(CV(i,n)),m.push(CV(S,r)),t.push(new StyPl(m,F,T,F,F,STR_NO,I,W1,0,0)),m=null}}}if(l)for(let s=1;s<=S;s++){const e=s+S*(o-1),p=1==o?0:s+S*(o-2),l=this.pIs[e],h=this.pIs[p];let y=myPs[l].p.x,i=myPs[l].p.y,n=myPs[h].p.x,T=myPs[h].p.y,P=[];P=this.createWedgePolyline(y,i,n,T,W3,5,.1),t.push(new StyPl(P,F,F,F,F,u,FIL_NO,W0,0,0)),P=null}if(e){let s=[];const e=this.pIs[0];s.push(myPs[e].p),t.push(new StyPl(s,F,F,F,T,STR_NO,I,W3,0,0));for(let s=1;s<=S;s++){const e=s+S*(o-1),p=this.pIs[e];let l=[];if(l.push(myPs[p].p),t.push(new StyPl(l,F,F,F,T,STR_NO,I,W3,0,0)),P){let s=[];s.push(myPs[p].p),t.push(new StyPl(s,F,F,F,T,STR_NO,1-I,i,0,0))}l=null}}if(n){const s=this.pIs[0],e=myPs[s].p.x,p=myPs[s].p.y;let l=[];if(this.id%2==0)l.push(CV(e,p)),t.push(new StyPl(l,F,F,F,T,u,1-I,W2,0,0));else{for(let s=1;s<=S;s++){const t=this.pIs[s],h=(4*e+myPs[t].p.x)/5,y=(4*p+myPs[t].p.y)/5;l.push(CV(h,y))}t.push(new StyPl(l,T,T,F,F,u,1-I,W1,0,0))}l=null}}break; case ST6:{let s=F,e=F,p=F,h=F;switch(this.STID){case 0:h=T;break;case 1:s=T,p=T;break;case 2:e=T;break;case 3:s=T,p=T,e=T}let y=FIL_BK,i=STR_BK;if(e||s||h){for(let s=0;s<l;s++)this.springs[s].getP().nSpringsAttachedTo=0,this.springs[s].getQ().nSpringsAttachedTo=0;for(let s=0;s<l;s++)this.springs[s].getP().nSpringsAttachedTo++,this.springs[s].getQ().nSpringsAttachedTo++}if(s){if(s)for(let s=0;s<l;s++){let e=[];const p=this.springs[s].getP(),l=this.springs[s].getQ();e.push(p.p),e.push(l.p);let h=min(p.nSpringsAttachedTo,l.nSpringsAttachedTo),i=W2*(this.springs[s].getRestL()/REST_L);1==h?t.push(new StyPl(e,F,T,T,F,STR_NO,y,i,0,0)):t.push(new StyPl(e,F,T,F,F,STR_NO,y,i,0,0)),e=null}}else for(let s=0;s<l;s++){let e=[];const p=this.springs[s].getP(),l=this.springs[s].getQ();e.push(p.p),e.push(l.p),t.push(new StyPl(e,F,T,F,F,STR_NO,y,W1,0,0)),e=null}if(p)for(let e=0;e<l;e++){const p=this.springs[e].getP(),l=this.springs[e].getQ();if(min(p.nSpringsAttachedTo,l.nSpringsAttachedTo)>1){let l=[];l.push(p.p);let h=s?W2*(this.springs[e].getRestL()/REST_L):W3;t.push(new StyPl(l,F,F,F,T,STR_NO,y,h,0,0)),l=null}}if(h){const s=.55,e=1-s;for(let p=0;p<l;p++){if(this.springs[p].getRestL()/REST_L>.7){const h=this.springs[p].getQ();if(h.nSpringsAttachedTo>1){const n=~~(5+Math.max(0,this.springs[p].getDistention())/REST_L)-1,T=this.springs[p].getP();for(let P=p+1;P<l;P++){const p=this.springs[P].getP();if(p==h){const l=this.springs[P].getQ();for(let P=1;P<n;P++){const I=P/n,u=(1-I)*s,S=1-u,a=1-I*(1-e),o=1-a,r=u*T.p.x+S*h.p.x,m=u*T.p.y+S*h.p.y,_=a*p.p.x+o*l.p.x,f=a*p.p.y+o*l.p.y;let c=[];c.push(CV(r,m)),c.push(CV(_,f)),t.push(new StyPl(c,F,F,F,F,i,y,W1,0,0)),c=null}}}}}}}if(e)for(let s=0;s<l;s++){let e=this.springs[s].getQ();if(1==e.nSpringsAttachedTo){let s=[];s.push(e.p),t.push(new StyPl(s,F,F,F,T,STR_NO,y,W3,0,0)),s=null}}}break; case ST1:{let p=W1,l=STR_BK,h=FIL_NO,y=F,i=W0,n=STR_BK,P=FIL_NO,I=0,u=F;if(s||(0==this.STID?(u=T,p=W2):1==this.STID?(y=T,h=FIL_BK,i=W1,n=STR_WH,P=FIL_NO):2==this.STID?(y=T,R20K[17]<.85&&(u=T,p=1.5*W1),h=FIL_NO,P=FIL_NO):3==this.STID?(y=T,h=FIL_WH,n=STR_NO,P=FIL_BK):4==this.STID?(y=T,h=FIL_WH,P=FIL_BK):5==this.STID?(y=T,h=FIL_NO,P=FIL_NO,I=3):6==this.STID&&(u=T,p=W1,l=STR_BK,h=FIL_NO)),this.bShowEnclBl){let s=PINF,t=NINF,p=PINF,l=NINF;for(let h=0;h<this.pIs.length;h++){const y=this.pIs[h];let i=myPs[y].p;e.push(i),i.x<s&&(s=i.x),i.x>t&&(t=i.x),i.y<p&&(p=i.y),i.y>l&&(l=i.y)}this.boundingBox={L:s,T:p,R:t,B:l}}else for(let s=0;s<this.pIs.length;s++){const t=this.pIs[s];e.push(myPs[t].p)}if(t.push(new StyPl(e,T,T,F,F,l,h,p,0,0,u)),e=null,y){let s=1.414*W2,e=this.pIs.length,p=[];for(let t=0;t<e;t++){const l=this.pIs[t],h=this.pIs[(t+1)%e],y=myPs[l].p.x,i=myPs[l].p.y;let n=myPs[h].p.x-y,F=myPs[h].p.y-i,T=Math.sqrt(n*n+F*F);n=n/T*s,F=F/T*s;let P=y-F,I=i+n;p.push(CV(P,I))}t.push(new StyPl(p,T,T,F,F,n,P,i,I,I,u)),p=null}}break;