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

2 lines
5.7 KiB
JavaScript
Raw Permalink Normal View History

2024-10-14 06:09:33 +00:00
!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,o=(3+8*n)*n;function r(t,n,e,o,r){let f,s,u,i,a=n[0],c=o[0],l=0,b=0;c>a==c>-a?(f=a,a=n[++l]):(f=c,c=o[++b]);let h=0;if(l<t&&b<e)for(c>a==c>-a?(s=a+f,u=f-(s-a),a=n[++l]):(s=c+f,u=f-(s-c),c=o[++b]),f=s,0!==u&&(r[h++]=u);l<t&&b<e;)c>a==c>-a?(s=f+a,i=s-f,u=f-(s-i)+(a-i),a=n[++l]):(s=f+c,i=s-f,u=f-(s-i)+(c-i),c=o[++b]),f=s,0!==u&&(r[h++]=u);for(;l<t;)s=f+a,i=s-f,u=f-(s-i)+(a-i),a=n[++l],f=s,0!==u&&(r[h++]=u);for(;b<e;)s=f+c,i=s-f,u=f-(s-i)+(c-i),c=o[++b],f=s,0!==u&&(r[h++]=u);return 0===f&&0!==h||(r[h++]=f),h}function f(t,n,o,r){let f,s,u,i,a,c,l,b,h,d,M;l=e*o,d=l-(l-o),M=o-d;let p=n[0];f=p*o,l=e*p,b=l-(l-p),h=p-b,u=h*M-(f-b*d-h*d-b*M);let y=0;0!==u&&(r[y++]=u);for(let x=1;x<t;x++)p=n[x],i=p*o,l=e*p,b=l-(l-p),h=p-b,a=h*M-(i-b*d-h*d-b*M),s=f+a,c=s-f,u=f-(s-c)+(a-c),0!==u&&(r[y++]=u),f=i+s,u=s-(f-i),0!==u&&(r[y++]=u);return 0===f&&0!==y||(r[y++]=f),y}function s(t){return new Float64Array(t)}const u=3330669073875473e-31,i=32047474274603644e-47,a=s(4),c=s(4),l=s(4),b=s(4),h=s(4),d=s(4),M=s(4),p=s(4),y=s(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-a)+(M-a),i[3]=j,4)}function B(t,n,o,r,f){let s,u,i,a,c,l,b,h,d,M,p,y,x;return p=n*o,u=e*n,i=u-(u-n),a=n-i,u=e*o,c=u-(u-o),l=o-c,y=a*l-(p-i*c-a*c-i*l),u=e*r,c=u-(u-r),l=r-c,b=y*r,u=e*y,i=u-(u-y),a=y-i,T[0]=a*l-(b-i*c-a*c-i*l),h=p*r,u=e*p,i=u-(u-p),a=p-i,M=a*l-(h-i*c-a*c-i*l),d=b+M,s=d-b,T[1]=b-(d-s)+(M-s),x=h+d,T[2]=d-(x-h),T[3]=x,t=v(t,4,T),0!==f&&(u=e*f,c=u-(u-f),l=f-c,b=y*f,u=e*y,i=u-(u-y),a=y-i,T[0]=a*l-(b-i*c-a*c-i*l),h=p*f,u=e*p,i=u-(u-p),a=p-i,M=a*l-(h-i*c-a*c-i*l),d=b+M,s=d-b,T[1]=b-(d-s)+(M-s),x=h+d,T[2]=d-(x-h),T[3]=x,t=v(t,4,T)),t}t.orient3d=function(t,n,s,T,q,C,D,E,G,H,I,J){const K=t-H,L=T-H,N=D-H,O=n-I,P=q-I,Q=E-I,R=s-J,S=C-J,U=G-J,V=L*Q,W=N*P,X=N*O,Y=K*Q,Z=K*P,$=L*O,_=R*(V-W)+S*(X-Y)+U*(Z-$),tt=(Math.abs(V)+Math.abs(W))*Math.abs(R)+(Math.abs(X)+Math.abs(Y))*Math.abs(S)+(Math.abs(Z)+Math.abs($))*Math.abs(U),nt=7771561172376103e-31*tt;return _>nt||-_>nt?_:function(t,n,s,T,q,C,D,E,G,H,I,J,K){let L,N,O,P,Q,R,S,U,V,W,X,Y,Z,$,_,tt,nt,et,ot,rt,ft,st,ut,it;const at=t-H,ct=T-H,lt=D-H,bt=n-I,ht=q-I,dt=E-I,Mt=s-J,pt=C-J,yt=G-J;rt=ct*dt,Y=e*ct,Z=Y-(Y-ct),$=ct-Z,Y=e*dt,_=Y-(Y-dt),tt=dt-_,ft=$*tt-(rt-Z*_-$*_-Z*tt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