2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
|
!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 f(t,n,e,o,f){let i,r,c,s,u=n[0],a=o[0],l=0,b=0;a>u==a>-u?(i=u,u=n[++l]):(i=a,a=o[++b]);let d=0;if(l<t&&b<e)for(a>u==a>-u?(r=u+i,c=i-(r-u),u=n[++l]):(r=a+i,c=i-(r-a),a=o[++b]),i=r,0!==c&&(f[d++]=c);l<t&&b<e;)a>u==a>-u?(r=i+u,s=r-i,c=i-(r-s)+(u-s),u=n[++l]):(r=i+a,s=r-i,c=i-(r-s)+(a-s),a=o[++b]),i=r,0!==c&&(f[d++]=c);for(;l<t;)r=i+u,s=r-i,c=i-(r-s)+(u-s),u=n[++l],i=r,0!==c&&(f[d++]=c);for(;b<e;)r=i+a,s=r-i,c=i-(r-s)+(a-s),a=o[++b],i=r,0!==c&&(f[d++]=c);return 0===i&&0!==d||(f[d++]=i),d}function i(t,n,e,o,i,r,c,s){return f(f(t,n,e,o,c),c,i,r,s)}function r(t,n,o,f){let i,r,c,s,u,a,l,b,d,h,p;l=e*o,h=l-(l-o),p=o-h;let M=n[0];i=M*o,l=e*M,b=l-(l-M),d=M-b,c=d*p-(i-b*h-d*h-b*p);let y=0;0!==c&&(f[y++]=c);for(let x=1;x<t;x++)M=n[x],s=M*o,l=e*M,b=l-(l-M),d=M-b,u=d*p-(s-b*h-d*h-b*p),r=i+u,a=r-i,c=i-(r-a)+(u-a),0!==c&&(f[y++]=c),i=s+r,c=r-(i-s),0!==c&&(f[y++]=c);return 0===i&&0!==y||(f[y++]=i),y}function c(t){return new Float64Array(t)}const s=4440892098500632e-31,u=5423418723394464e-46,a=c(4),l=c(4),b=c(4),d=c(4),h=c(4),p=c(4),M=c(4),y=c(4),x=c(8),g=c(8),m=c(8),T=c(8),j=c(8),w=c(8),A=c(8),F=c(8),k=c(8),q=c(4),v=c(4),z=c(4),B=c(8),C=c(16),D=c(16),E=c(16),G=c(32),H=c(32),I=c(48),J=c(64);let K=c(1152),L=c(1152);function N(t,n,e){t=f(t,K,n,e,L);const o=K;return K=L,L=o,t}t.incircle=function(t,n,c,L,O,P,Q,R){const S=t-Q,U=c-Q,V=O-Q,W=n-R,X=L-R,Y=P-R,Z=U*Y,$=V*X,_=S*S+W*W,tt=V*W,nt=S*Y,et=U*U+X*X,ot=S*X,ft=U*W,it=V*V+Y*Y,rt=_*(Z-$)+et*(tt-nt)+it*(ot-ft),ct=(Math.abs(Z)+Math.abs($))*_+(Math.abs(tt)+Math.abs(nt))*et+(Math.abs(ot)+Math.abs(ft))*it,st=11102230246251577e-31*ct;return rt>st||-rt>st?rt:function(t,n,c,L,O,P,Q,R,S){let U,V,W,X,Y,Z,$,_,tt,nt,et,ot,ft,it,rt,ct,st,ut,at,lt,bt,dt,ht,pt,Mt,yt,xt,gt,mt,Tt,jt,wt,At,Ft,kt;const qt=t-Q,vt=c-Q,zt=O-Q,Bt=n-R,Ct=L-R,Dt=P-R;jt=vt*Dt,ht=e*vt,pt=ht-(ht-vt),Mt=vt-pt,ht=e*Dt,yt=ht-(ht-Dt),xt=Dt-yt,wt=Mt*xt-(jt-pt*yt-Mt*yt-pt*xt),At=zt*Ct,ht=e*zt,pt=ht-(ht-zt),Mt=zt-pt,ht=e*Ct,yt=ht-(ht-Ct),xt=Ct-yt,Ft=Mt*xt-(At-pt*yt-Mt*yt-pt*xt),gt=wt-Ft,dt=wt-gt,a[0]=wt-(gt+dt)+(dt-Ft),mt=jt+gt,dt=mt-jt,Tt=jt-(mt-dt)+(gt-dt),gt=Tt-At,dt=Tt-gt,a[1]=Tt-(gt+dt)+(dt-At),kt=mt+gt,dt=kt-mt,a[2]=mt-(kt-dt)+(gt-dt),a[3]=kt,jt=zt*Bt,ht=e*zt,pt=ht-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