package.umd.predicates.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of robust-predicates Show documentation
Show all versions of robust-predicates Show documentation
Fast robust predicates for computational geometry
The newest version!
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).predicates={})}(this,(function(t){"use strict";const n=11102230246251565e-32,e=134217729,r=(3+8*n)*n;function s(t,n,e,r,s){let o,a,c,u,f=n[0],i=r[0],h=0,b=0;i>f==i>-f?(o=f,f=n[++h]):(o=i,i=r[++b]);let M=0;if(hf==i>-f?(a=f+o,c=o-(a-f),f=n[++h]):(a=i+o,c=o-(a-i),i=r[++b]),o=a,0!==c&&(s[M++]=c);hf==i>-f?(a=o+f,u=a-o,c=o-(a-u)+(f-u),f=n[++h]):(a=o+i,u=a-o,c=o-(a-u)+(i-u),i=r[++b]),o=a,0!==c&&(s[M++]=c);for(;h=bt||-ht>=bt)return ht;if(J=t-$,O=t-($+J)+(J-x),J=n-rt,z=n-(rt+J)+(J-g),J=a-ct,E=a-(ct+J)+(J-j),J=f-tt,P=f-(tt+J)+(J-x),J=i-st,B=i-(st+J)+(J-g),J=h-ut,G=h-(ut+J)+(J-j),J=b-nt,k=b-(nt+J)+(J-x),J=M-ot,C=M-(ot+J)+(J-g),J=l-ft,H=l-(ft+J)+(J-j),J=d-et,q=d-(et+J)+(J-x),J=p-at,D=p-(at+J)+(J-g),J=y-it,I=y-(it+J)+(J-j),0===O&&0===z&&0===E&&0===P&&0===B&&0===G&&0===k&&0===C&&0===H&&0===q&&0===D&&0===I)return ht;bt=8751425667295619e-46*m+r*Math.abs(ht);const Mt=$*B+st*O-(rt*P+tt*z),Nt=tt*C+ot*P-(st*k+nt*B),Qt=nt*D+at*k-(ot*q+et*C),Rt=et*z+rt*q-(at*O+$*D),St=$*C+ot*O-(rt*k+nt*z),Ut=tt*D+at*P-(st*q+et*B);return ht+=(tt*tt+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t=bt-(bt-g),yt=g-pt,vt=dt*yt-(_t-lt*pt-dt*pt-lt*yt),xt=Tt-vt,E=Tt-xt,tt[0]=Tt-(xt+E)+(E-vt),gt=mt+xt,E=gt-mt,jt=mt-(gt-E)+(xt-E),xt=jt-_t,E=jt-xt,tt[1]=jt-(xt+E)+(E-_t),wt=gt+xt,E=wt-gt,tt[2]=gt-(wt-E)+(xt-E),tt[3]=wt,q=4):(Y[0]=0,O=1,tt[0]=0,q=1),0!==x){const t=a(O,Y,x,at);d=Mt(d,s(a(A,W,x,st),st,a(t,at,2*Ot,ct),ct,ft),ft);const n=a(q,tt,x,rt);d=Mt(d,o(a(n,rt,2*Ot,st),st,a(n,rt,x,ot),ot,a(t,at,x,ct),ct,ut,it),it),0!==g&&(d=Mt(d,a(a(4,K,x,rt),rt,g,st),st)),0!==j&&(d=Mt(d,a(a(4,J,-x,rt),rt,j,st),st))}if(0!==m){const t=a(O,Y,m,at);d=Mt(d,s(a(F,X,m,st),st,a(t,at,2*qt,ct),ct,ft),ft);const n=a(q,tt,m,rt);d=Mt(d,o(a(n,rt,2*qt,st),st,a(n,rt,m,ot),ot,a(t,at,m,ct),ct,ut,it),it)}}return ht[d-1]}(t,n,c,f,i,h,b,M,k)},t.incirclefast=function(t,n,e,r,s,o,a,c){const u=t-a,f=n-c,i=e-a,h=r-c,b=s-a,M=o-c;return(u*u+f*f)*(i*M-b*h)+(i*i+h*h)*(b*f-u*M)+(b*b+M*M)*(u*h-i*f)},t.insphere=function(t,n,e,r,s,o,a,c,u,f,i,h,b,M,l){const d=t-b,p=r-b,y=a-b,x=f-b,g=n-M,j=s-M,m=c-M,T=i-M,_=e-l,v=o-l,w=u-l,A=h-l,F=d*j,O=p*g,P=F-O,k=p*m,q=y*j,z=k-q,B=y*T,C=x*m,D=B-C,E=x*g,G=d*T,H=E-G,I=d*m,J=y*g,K=I-J,L=p*T,N=x*j,Q=L-N,R=d*d+g*g+_*_,S=p*p+j*j+v*v,U=y*y+m*m+w*w,V=x*x+T*T+A*A,W=U*(A*P+_*Q+v*H)-V*(_*z-v*K+w*P)+(R*(v*D-w*Q+A*z)-S*(w*H+A*K+_*D)),X=Math.abs(_),Y=Math.abs(v),Z=Math.abs(w),$=Math.abs(A),tt=Math.abs(F),nt=Math.abs(O),et=Math.abs(k),rt=Math.abs(q),st=Math.abs(B),ot=Math.abs(C),at=Math.abs(E),ct=Math.abs(G),ut=Math.abs(I),ft=Math.abs(J),it=Math.abs(L),ht=Math.abs(N),bt=((st+ot)*Y+(ht+it)*Z+(et+rt)*$)*R+((at+ct)*Z+(ut+ft)*$+(st+ot)*X)*S+((tt+nt)*$+(it+ht)*X+(at+ct)*Y)*U+((et+rt)*X+(ft+ut)*Y+(tt+nt)*Z)*V,Mt=17763568394002532e-31*bt;return W>Mt||-W>Mt?W:-fn(t,n,e,r,s,o,a,c,u,f,i,h,b,M,l,bt)},t.inspherefast=function(t,n,e,r,s,o,a,c,u,f,i,h,b,M,l){const d=t-b,p=r-b,y=a-b,x=f-b,g=n-M,j=s-M,m=c-M,T=i-M,_=e-l,v=o-l,w=u-l,A=h-l,F=d*j-p*g,O=p*m-y*j,P=y*T-x*m,k=x*g-d*T,q=d*m-y*g,z=p*T-x*j;return(y*y+m*m+w*w)*(A*F+_*z+v*k)-(x*x+T*T+A*A)*(_*O-v*q+w*F)+((d*d+g*g+_*_)*(v*P-w*z+A*O)-(p*p+j*j+v*v)*(w*k+A*q+_*P))},t.orient2d=function(t,n,o,a,c,f){const d=(n-f)*(o-c),p=(t-c)*(a-f),y=d-p;if(0===d||0===p||d>0!=p>0)return y;const x=Math.abs(d+p);return Math.abs(y)>=33306690738754716e-32*x?y:-function(t,n,o,a,c,f,d){let p,y,x,g,j,m,T,_,v,w,A,F,O,P,k,q,z,B;const C=t-c,D=o-c,E=n-f,G=a-f;P=C*G,m=e*C,T=m-(m-C),_=C-T,m=e*G,v=m-(m-G),w=G-v,k=_*w-(P-T*v-_*v-T*w),q=E*D,m=e*E,T=m-(m-E),_=E-T,m=e*D,v=m-(m-D),w=D-v,z=_*w-(q-T*v-_*v-T*w),A=k-z,j=k-A,i[0]=k-(A+j)+(j-z),F=P+A,j=F-P,O=P-(F-j)+(A-j),A=O-q,j=O-A,i[1]=O-(A+j)+(j-q),B=F+A,j=B-F,i[2]=F-(B-j)+(A-j),i[3]=B;let H=u(4,i),I=22204460492503146e-32*d;if(H>=I||-H>=I)return H;if(j=t-C,p=t-(C+j)+(j-c),j=o-D,x=o-(D+j)+(j-c),j=n-E,y=n-(E+j)+(j-f),j=a-G,g=a-(G+j)+(j-f),0===p&&0===y&&0===x&&0===g)return H;if(I=11093356479670487e-47*d+r*Math.abs(H),H+=C*g+G*p-(E*x+D*y),H>=I||-H>=I)return H;P=p*G,m=e*p,T=m-(m-p),_=p-T,m=e*G,v=m-(m-G),w=G-v,k=_*w-(P-T*v-_*v-T*w),q=y*D,m=e*y,T=m-(m-y),_=y-T,m=e*D,v=m-(m-D),w=D-v,z=_*w-(q-T*v-_*v-T*w),A=k-z,j=k-A,l[0]=k-(A+j)+(j-z),F=P+A,j=F-P,O=P-(F-j)+(A-j),A=O-q,j=O-A,l[1]=O-(A+j)+(j-q),B=F+A,j=B-F,l[2]=F-(B-j)+(A-j),l[3]=B;const J=s(4,i,4,l,h);P=C*g,m=e*C,T=m-(m-C),_=C-T,m=e*g,v=m-(m-g),w=g-v,k=_*w-(P-T*v-_*v-T*w),q=E*x,m=e*E,T=m-(m-E),_=E-T,m=e*x,v=m-(m-x),w=x-v,z=_*w-(q-T*v-_*v-T*w),A=k-z,j=k-A,l[0]=k-(A+j)+(j-z),F=P+A,j=F-P,O=P-(F-j)+(A-j),A=O-q,j=O-A,l[1]=O-(A+j)+(j-q),B=F+A,j=B-F,l[2]=F-(B-j)+(A-j),l[3]=B;const K=s(J,h,4,l,b);P=p*g,m=e*p,T=m-(m-p),_=p-T,m=e*g,v=m-(m-g),w=g-v,k=_*w-(P-T*v-_*v-T*w),q=y*x,m=e*y,T=m-(m-y),_=y-T,m=e*x,v=m-(m-x),w=x-v,z=_*w-(q-T*v-_*v-T*w),A=k-z,j=k-A,l[0]=k-(A+j)+(j-z),F=P+A,j=F-P,O=P-(F-j)+(A-j),A=O-q,j=O-A,l[1]=O-(A+j)+(j-q),B=F+A,j=B-F,l[2]=F-(B-j)+(A-j),l[3]=B;const L=s(K,b,4,l,M);return M[L-1]}(t,n,o,a,c,f,x)},t.orient2dfast=function(t,n,e,r,s,o){return(n-o)*(e-s)-(t-s)*(r-o)},t.orient3d=function(t,n,o,c,f,i,h,b,M,l,F,B){const G=t-l,H=c-l,I=h-l,J=n-F,K=f-F,L=b-F,N=o-B,Q=i-B,R=M-B,S=H*L,U=I*K,V=I*J,W=G*L,X=G*K,Y=H*J,Z=N*(S-U)+Q*(V-W)+R*(X-Y),$=(Math.abs(S)+Math.abs(U))*Math.abs(N)+(Math.abs(V)+Math.abs(W))*Math.abs(Q)+(Math.abs(X)+Math.abs(Y))*Math.abs(R),tt=7771561172376103e-31*$;return Z>tt||-Z>tt?Z:function(t,n,o,c,f,i,h,b,M,l,F,B,G){let H,I,J,K,L,N,Q,R,S,U,V,W,X,Y,Z,$,tt,nt,et,rt,st,ot,at,ct;const ut=t-l,ft=c-l,it=h-l,ht=n-F,bt=f-F,Mt=b-F,lt=o-B,dt=i-B,pt=M-B;rt=ft*Mt,W=e*ft,X=W-(W-ft),Y=ft-X,W=e*Mt,Z=W-(W-Mt),$=Mt-Z,st=Y*$-(rt-X*Z-Y*Z-X*$),ot=it*bt,W=e*it,X=W-(W-it),Y=it-X,W=e*bt,Z=W-(W-bt),$=bt-Z,at=Y*$-(ot-X*Z-Y*Z-X*$),tt=st-at,V=st-tt,d[0]=st-(tt+V)+(V-at),nt=rt+tt,V=nt-rt,et=rt-(nt-V)+(tt-V),tt=et-ot,V=et-tt,d[1]=et-(tt+V)+(V-ot),ct=nt+tt,V=ct-nt,d[2]=nt-(ct-V)+(tt-V),d[3]=ct,rt=it*ht,W=e*it,X=W-(W-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-(bt*K+it*N))+R*(ft*Mt-bt*it)+dt*(it*L+ht*K-(Mt*I+ut*Q))+S*(it*ht-Mt*ut)+pt*(ut*N+bt*I-(ht*J+ft*L))+U*(ut*bt-ht*ft),yt>=xt||-yt>=xt)return yt;const gt=D(I,L,ft,bt,it,Mt,x,g),jt=D(J,N,it,Mt,ut,ht,j,m),mt=D(K,Q,ut,ht,ft,bt,T,_),Tt=s(jt,j,mt,_,v);H=C(H,a(Tt,v,lt,k),k);const _t=s(mt,T,gt,g,w);H=C(H,a(_t,w,dt,k),k);const vt=s(gt,x,jt,m,A);return H=C(H,a(vt,A,pt,k),k),0!==R&&(H=C(H,a(4,d,R,q),q),H=C(H,a(Tt,v,R,k),k)),0!==S&&(H=C(H,a(4,p,S,q),q),H=C(H,a(_t,w,S,k),k)),0!==U&&(H=C(H,a(4,y,U,q),q),H=C(H,a(vt,A,U,k),k)),0!==I&&(0!==N&&(H=E(H,I,N,pt,U)),0!==Q&&(H=E(H,-I,Q,dt,S))),0!==J&&(0!==Q&&(H=E(H,J,Q,lt,R)),0!==L&&(H=E(H,-J,L,pt,U))),0!==K&&(0!==L&&(H=E(H,K,L,dt,S)),0!==N&&(H=E(H,-K,N,lt,R))),z[H-1]}(t,n,o,c,f,i,h,b,M,l,F,B,$)},t.orient3dfast=function(t,n,e,r,s,o,a,c,u,f,i,h){const b=n-i,M=s-i,l=c-i,d=e-h,p=o-h,y=u-h;return(t-f)*(M*y-p*l)+(r-f)*(l*d-y*b)+(a-f)*(b*p-d*M)},Object.defineProperty(t,"__esModule",{value:!0})}));