blowfish/node_modules/robust-predicates/umd/orient3d.min.js

2 lines
5.7 KiB
JavaScript
Raw Normal View History

2023-01-29 22:30:24 +00:00
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).predicates={})}(this,(function(t){"use strict";const e=134217729;function n(t,e,n,o,r){let f,u,s,i,a=e[0],c=o[0],l=0,b=0;c>a==c>-a?(f=a,a=e[++l]):(f=c,c=o[++b]);let d=0;if(l<t&&b<n)for(c>a==c>-a?(u=a+f,s=f-(u-a),a=e[++l]):(u=c+f,s=f-(u-c),c=o[++b]),f=u,0!==s&&(r[d++]=s);l<t&&b<n;)c>a==c>-a?(u=f+a,i=u-f,s=f-(u-i)+(a-i),a=e[++l]):(u=f+c,i=u-f,s=f-(u-i)+(c-i),c=o[++b]),f=u,0!==s&&(r[d++]=s);for(;l<t;)u=f+a,i=u-f,s=f-(u-i)+(a-i),a=e[++l],f=u,0!==s&&(r[d++]=s);for(;b<n;)u=f+c,i=u-f,s=f-(u-i)+(c-i),c=o[++b],f=u,0!==s&&(r[d++]=s);return 0===f&&0!==d||(r[d++]=f),d}function o(t,n,o,r){let f,u,s,i,a,c,l,b,d,h,M;l=e*o,h=l-(l-o),M=o-h;let p=n[0];f=p*o,l=e*p,b=l-(l-p),d=p-b,s=d*M-(f-b*h-d*h-b*M);let y=0;0!==s&&(r[y++]=s);for(let x=1;x<t;x++)p=n[x],i=p*o,l=e*p,b=l-(l-p),d=p-b,a=d*M-(i-b*h-d*h-b*M),u=f+a,c=u-f,s=f-(u-c)+(a-c),0!==s&&(r[y++]=s),f=i+u,s=u-(f-i),0!==s&&(r[y++]=s);return 0===f&&0!==y||(r[y++]=f),y}function r(t){return new Float64Array(t)}const f=r(4),u=r(4),s=r(4),i=r(4),a=r(4),c=r(4),l=r(4),b=r(4),d=r(4),h=r(8),M=r(8),p=r(8),y=r(4),x=r(8),g=r(8),j=r(8),m=r(12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h,M,p,x,g;return p=n*o,s=e*n,i=s-(s-n),a=n-i,s=e*o,c=s-(s-o),l=o-c,x=a*l-(p-i*c-a*c-i*l),s=e*r,c=s-(s-r),l=r-c,b=x*r,s=e*x,i=s-(s-x),a=x-i,y[0]=a*l-(b-i*c-a*c-i*l),d=p*r,s=e*p,i=s-(s-p),a=p-i,M=a*l-(d-i*c-a*c-i*l),h=b+M,u=h-b,y[1]=b-(h-u)+(M-u),g=d+h,y[2]=h-(g-d),y[3]=g,t=v(t,4,y),0!==f&&(s=e*f,c=s-(s-f),l=f-c,b=x*f,s=e*x,i=s-(s-x),a=x-i,y[0]=a*l-(b-i*c-a*c-i*l),d=p*f,s=e*p,i=s-(s-p),a=p-i,M=a*l-(d-i*c-a*c-i*l),h=b+M,u=h-b,y[1]=b-(h-u)+(M-u),g=d+h,y[2]=h-(g-d),y[3]=g,t=v(t,4,y)),t}t.orient3d=function(t,r,y,_,F,O,P,k,q,z,B,C){const D=t-z,E=_-z,G=P-z,H=r-B,I=F-B,J=k-B,K=y-C,L=O-C,N=q-C,Q=E*J,R=G*I,S=G*H,U=D*J,V=D*I,W=E*H,X=K*(Q-R)+L*(S-U)+N*(V-W),Y=(Math.abs(Q)+Math.abs(R))*Math.abs(K)+(Math.abs(S)+Math.abs(U))*Math.abs(L)+(Math.abs(V)+Math.abs(W))*Math.abs(N),Z=7771561172376103e-31*Y;return X>Z||-X>Z?X:function(t,r,y,_,F,O,P,k,q,z,B,C,D){let E,G,H,I,J,K,L,N,Q,R,S,U,V,W,X,Y,Z,$,tt,et,nt,ot,rt,ft;const ut=t-z,st=_-z,it=P-z,at=r-B,ct=F-B,lt=k-B,bt=y-C,dt=O-C,ht=q-C;et=st*lt,U=e*st,V=U-(U-st),W=st-V,U=e*lt,X=U-(U-lt),Y=lt-X,nt=W*Y-(et-V*X-W*X-V*Y),ot=it*ct,U=e*it,V=U-(U-it),W=it-V,U=e*ct,X=U-(U-ct),Y=ct-X,rt=W*Y-(ot-V*X-W*X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